Let it snow
How do I make an let it snow?
What is a let it snow? How do you make a let it snow? This script and codes were developed by Findoff on 03 October 2022, Monday.
Let it snow - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>let it snow</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5.1/dat.gui.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Let it snow - Script Codes JS Codes
console.clear();
document.addEventListener('DOMContentLoaded', function(){ let stats = new Stats(); stats.showPanel( 0 ); stats.domElement.style.position = 'absolute'; //let panel = stats.addPanel( new Stats.Panel( 'caption', '#ff8', '#221' ) ); // panel.update(value, maxValue); document.body.appendChild( stats.domElement ); /* i love DOM */ var canvas = document.createElement('canvas'); document.body.appendChild(canvas); document.body.style.padding = '0px'; document.body.style.margin = '0px'; document.body.style.overflow = 'hidden'; /* i love full screen */ var w = canvas.width = window.innerWidth; var h = canvas.height = window.innerHeight; var ctx = canvas.getContext('2d'); /* i love bad short opts ^__^ like q or qwe */ var opts = { }; var gui = new dat.GUI(); function opt(name, value, min, max){ opts[name] = value; return gui.add(opts, name, min, max); } /* if code.before > ugly -> just.dont.read(below) // below worse... ==== let's begin. ==== */ class Snow{ constructor(ctx, count){ this.w = ctx.canvas.width; this.h = ctx.canvas.height; this.count = count; this.r = this.w * 1; this.particles = []; this.vel = [0.5,2,0]; this.a = 0; this.av = Math.PI/256; while(this.particles.length<this.count) this.particles.push( this.gen([], 1) ); } gen(p, zs){ zs = zs || 0; let a = Math.random()*Math.PI*2; let r = this.r * Math.random(); p[0] = Math.cos(a) * r; p[2] = Math.sin(a) * r; p[1] = -this.h + Math.random()*this.h * zs * 2; return p; } process(){ for(let p of this.particles){ p[0] += this.vel[0]; p[1] += this.vel[1]; p[2] += this.vel[2]; //if( Math.hypot(p[0], p[2]) > this.r || p[1] > this.h ) //this.gen(p); } } render(){ this.a += this.av; let rx = Math.cos(this.a); let ry = Math.sin(this.a); for(let p of this.particles){ let x = p[0] * rx - p[2] * ry; let z = p[2] * rx + p[0] * ry; let t = [ x, p[1], (z + this.r)/200, 5, ]; if( t[2] < 0 ) continue; t[0] = this.w/2 + t[0]/t[2]; t[1] = this.h/2 + t[1]/t[2]; t[3] /= t[2]; ctx.beginPath(); ctx.arc(t[0], t[1], t[3], 0,Math.PI*2, 0); ctx.fillStyle = '#fff'; ctx.fill(); if( t[0] < 0 || t[0] > this.w || t[1] < 0 || t[1] > this.h ) this.gen(p); } } } let snow = new Snow(ctx, 300); //opt('text', 'test'); function loop(){ stats.begin(); ctx.globalAlpha = 1; let g = ctx.createLinearGradient(0,0, 0,h); g.addColorStop(0, '#004'); g.addColorStop(1, '#000'); ctx.fillStyle = g; ctx.fillRect(0,0, w,h); ctx.globalAlpha = 1; snow.process(); snow.render(); requestAnimationFrame(loop); stats.end(); } loop();
}, false);
Developer | Findoff |
Username | findoff |
Uploaded | October 03, 2022 |
Rating | 4.5 |
Size | 2,600 Kb |
Views | 24,288 |
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!
Name | Size |
Deflectors vs asteroids | 3,565 Kb |
Curved fractal | 2,430 Kb |
Screeps body calculator | 6,315 Kb |
Insect builder v0 | 3,425 Kb |
Flamethrower | 2,654 Kb |
Ant | 2,365 Kb |
Lightning | 2,284 Kb |
A Pen by findoff | 2,637 Kb |
Stick waves 2 | 2,827 Kb |
Through penises... | 2,057 Kb |
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!
Name | Username | Size |
Realistic Buttons | Stoypenny | 2,248 Kb |
Responsive Section hover effect to show content | Berdejitendra | 2,540 Kb |
Hoi hoi | JohnTheCat | 7,248 Kb |
Delete Hover | Chungman93 | 2,557 Kb |
Adding Items | Valhead | 4,008 Kb |
CSS Flip Animation | Bbodine1 | 2,525 Kb |
Animated Logo | Shakdaniel | 2,672 Kb |
Pruebas de d3.js | Juanmanuelcarnerero | 2,485 Kb |
Codero Sitemap | S1m0ne | 28,169 Kb |
Under construction | GhostRider | 1,642 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!