gridfader.js is a JavaScript object that creates a grid of cells on a provided canvas element that randomly fade in using one random color from a provided palette.
A viewable demo is available at http://xcjs.github.io/gridfader.js/
The object is designed to handle all of its own event bindings itself once initialized:
(function() {
var fader = new GridFader('gridfader');
fader.palette.push(new fader.ColorManagement.Color({ r: 32, g: 48, b: 51 }));
fader.palette.push(new fader.ColorManagement.Color({ r: 95, g: 104, b: 84 }));
fader.palette.push(new fader.ColorManagement.Color({ r: 115, g: 142, b: 165 }));
fader.palette.push(new fader.ColorManagement.Color({ r: 202, g: 178, b: 161 }));
fader.palette.push(new fader.ColorManagement.Color({ r: 236, g: 238, b: 244 }));
fader.gridColor = new fader.ColorManagement.Color({ r: 0, g: 0, b: 0, a: .5 });
fader.cellSize = 48;
fader.gridSize = 5;
fader.fadeStep = .001;
fader.clockSpeed = 3;
fader.BindEvents();
})();
Once all of the required properties are assigned, BindEvents will need to be called.
var fader = new GridFader('canvasId');
The constructor only takes the ID of the affected canvas element.
Property | Type | Required? | About |
---|---|---|---|
palette | Array<GridFader.ColorManagement.Color> | ✓ |
An array of colors that gridfader.js will randomly select from.
|
Method | About |
---|---|
BindEvents() | Once all of the properties have been set, call BindEvents() to start gridfader.js. |