Category Archives: HTML

HTML5 Canvas – Nice flame/fire effect using particles

Try following HTML script. Shows nice flaming/fire effect using Javascript and CSS.

Javscript:
window.onload = function(){
var canvas = document.getElementById(“canvas”);
var ctx = canvas.getContext(“2d”);

//Make the canvas occupy the full page
var W = window.innerWidth, H = window.innerHeight;
canvas.width = W;
canvas.height = H;

var particles = [];
var mouse = {};

//Lets create some particles now
var particle_count = 100;
for(var i = 0; i < particle_count; i++)
{
particles.push(new particle());
}

//finally some mouse tracking
canvas.addEventListener(‘mousemove’, track_mouse, false);

Continue reading →