Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
html, body { background: #222; padding: 0; margin: 0; } canvas { width: 100%; height: 100%; max-height: 400px; } .padded { background: #111; padding: 0 10%; }
var canvas; var ctx; var config = { sparkFreq: 1, meanSparkSize: 0.012, meanSparkLife: 200, meanSparkVelocity: [ 2, 6 ], sparkSizeVariation: 5, sparkBlink: 10, // Lower is more blink floorHeight: 0.15 }; var resize = window.resize = function() { canvas.height = document.body.offsetHeight; canvas.width = document.body.offsetWidth; }; window.onload = function() { canvas = document.getElementById('canvas'); ctx = canvas.getContext('2d'); resize(); config.meanSparkSize = canvas.width*config.meanSparkSize; var fire = new Fire(ctx, canvas, canvas.height-canvas.height*config.floorHeight, config); var loop = function() { window.requestAnimFrame(loop); ctx.clearRect(0, 0, canvas.width, canvas.height); fire.update(); for (var i=0; i