Ajax Loader
×

HTML5 Canvas Fountain - Exploding Particles with Gravity

A canvas experiment to demonstrate how to implement gravity. Multiple particles are created and stored in an array. Then the array is looped and a random velocity is added on the x and y axis of the particle.

Gravity is a random value applied on the y velocity causing an increase in the y position, i.e., moving the particle downwards.

It is important to note that the initial random velocity on the y axis is negative to make sure that the particles move upwards first.

Here's a full tutorial if you want to read further.

Related:

HTML
 
1
 
 
CSS
 
1
 
 
JavaScript
 
1
 
 

HTML5 Canvas Fountain - Exploding Particles with Gravity

CSSDeck G+