canvas particles
Particle generator for html5 canvas animation
examples
Default options create particles with zero gravity and random x and y velocities. Demo.
var Particles = ; window { // Create an empty canvas and place it on the page var canvas = document; canvaswidth = 800; canvasheight = 500; // black canvas canvas; documentbody; var particles = ; // called on every frame before the particles happen { ctxfillStyle = "black"; ctx; }};
Falling particles with random origin and random x velocity. Demo.
var Particles = ; window { var canvas = document; canvaswidth = 800; canvasheight = 500; canvas; documentbody; // falling particles with random x velocity and random origin var range = 50; var xMax = canvaswidth / 2 + range; var xMin = canvaswidth/2 - range; var yMax = canvasheight / 2 + range; var yMin = canvasheight/2 - range; var particles = ; { ctxfillStyle = "white"; ctx; }};
Configuration
// options and their defaults, none are requiredvar particles =