This time we are going to introduce this HTML5 Canvas based flame animation is very special, it is the brush with flame animation, the brush brush brush on the canvas when drawing, the lines with flame animation, very good.
Advertisement
var fss = []; loop(); function loop() { c.updateFPS(); c.background("darkred"); for (var i = 0; i < fss.length; i++) { fss[i].run(); } if (c.mouse.click) fss.push(new FireSystem(c.mouse.x, c.mouse.y, 25)); requestAnimationFrame(loop); } function FireSystem (x, y, size) { this.particles = []; this.x = x; this.y = y; this.size = size; this.run = function() { for (var i = this.particles.length-1; i >= 0; i--) { var p = this.particles[i]; p.update(); if (p.life <= 0) { this.particles.splice(i, 1); this.particles.push(new Fire(this.x, this.y, this.size)); } p.render(); } if (this.particles.length < 50) this.particles.push(new Fire(this.x, this.y, size)); } }
Advertisement