WebGL animated points module (3d).
Features
- Points State is a fixed set of points positions.
- Each Points State can be initialized with
- Array of positions in 3d space (rawData).
- Width, height, depth and zDistance of axis-aligned Box containing all points (box). Points are pseudo-randomly placed.
- Image mask in PBM binary format + parameters of Box as in previous item (maskedBoxFromImage).
- Image matrix + parameters of Box (maskedBoxFromMatrix).
- Module can be initialized with arbitrary amount of Points States.
- User can choose 2 arbitrary Points States and make a transition between them by setting BlendProgress.
- Module has points amount / size, colors, camera settings.
- Module uses webworker for computing points positions.
Usage
- Include app.js script from dist/scripts.
- Call
window.maskedPoints.init(settings)
to initialize module. - Settings example could be found in src/index.html.
API
var maskedPoints = window.maskedPoints.init(settings);
document.addEventListener('maskedPointsReady', function() {
// initialization completed.
});
maskedPoints.updateCamera(time); // if interactive camera is needed. time in seconds for inertia.
maskedPoints.updateBlendProgress(weight); // weight in [0, 1]
maskedPoints.render(); // draws current state
maskedPoints.setBlendStates(state1_index, state2_index); // params are integer indices as states go in settings.
maskedPoints.setBackgroundColor([r, g, b]); // in [0, 1]
maskedPoints.setPointsColor([r, g, b]); // in [0, 1]
Development
To launch the project locally:
- Install Node.js v5 or higher.
- Clone project to your hard drive.
- Run "npm install" in project root directory.
- Run "gulp watch" to start development webserver.
- Look in terminal what port is used and navigate to http://localhost:${port}
- To update build run "gulp build".