Fire

Developer
Size
3,542 Kb
Views
28,336

How do I make an fire?

What is a fire? How do you make a fire? This script and codes were developed by Aitor on 16 September 2022, Friday.

Fire Previews

Fire - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fire</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<canvas width="640" height="640"></canvas> <script src="js/index.js"></script>
</body>
</html>

Fire - Script Codes CSS Codes

html,
body { background: #000; color: #fff; margin: 0; padding: 0; overflow: hidden; font-family: monospace;
}

Fire - Script Codes JS Codes

"use strict";
var canvas = document.querySelector("canvas"), context = canvas.getContext("2d");
var branches = [];
function createBranch() { var x = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; var y = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1]; var direction = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; branches.push({ x: x, y: y, direction: direction, velocity: 0, startTime: Date.now(), currentTime: Date.now(), time: 0, duration: Math.random() * 2000 });
}
function render(now) { var cx = canvas.width * 0.5, cy = canvas.height * 0.5; while (branches.length < 3000) { createBranch(Math.random() * canvas.width, canvas.height, Math.PI * -0.5); } context.clearRect(0, 0, canvas.width, canvas.height); for (var index = branches.length - 1; index >= 0; index--) { var branch = branches[index]; if (branch.time < branch.duration) { context.beginPath(); context.moveTo(branch.x, branch.y); branch.x += Math.cos(branch.direction) * branch.velocity; branch.y += Math.sin(branch.direction) * branch.velocity; branch.velocity += 0.5; context.globalCompositeOperation = "lighter"; context.globalAlpha = Math.pow(1.0 - branch.time / branch.duration, 2); context.lineTo(branch.x, branch.y); context.lineCap = "round"; context.lineWidth = (1.0 - branch.time / branch.duration + 0.0) * 50; context.strokeStyle = "rgba(255,30,20,1.0)"; context.stroke(); branch.direction += (Math.random() - 0.5) * Math.PI * 0.1; branch.currentTime = Date.now(); branch.time = branch.currentTime - branch.startTime; //branches[index] = branch; } else { branches.splice(index, 1); } } window.requestAnimationFrame(render);
}
function resize() { canvas.width = window.innerWidth; canvas.height = window.innerHeight;
}
window.addEventListener("resize", resize);
resize();
render();
Fire - Script Codes
Fire - Script Codes
Home Page Home
Developer Aitor
Username AzazelN28
Uploaded September 16, 2022
Rating 3.5
Size 3,542 Kb
Views 28,336
Do you need developer help for Fire?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Aitor (AzazelN28) Script Codes
Name
Blending Experiment 29
Adventure
Branches
Physics 101
Worm
Clock
Dancing Text
Date Input
Asteroids
Superformula
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!