Пусни сняг върху кой да е сайт в интернет — без да инсталираш нищо.
var platno = document.createElement("canvas");
platno.style.cssText = "position:fixed;top:0;left:0;pointer-events:none;z-index:999999";
document.body.appendChild(platno);
var molivche = platno.getContext("2d");
platno.width = innerWidth;
platno.height = innerHeight;
var snejinki = [];
for (var i = 0; i < 200; i++) {
snejinki[i] = { x: Math.random() * innerWidth, y: Math.random() * innerHeight, r: Math.random() * 3 + 1, v: Math.random() + 0.5 };
}
function kadur() {
molivche.clearRect(0, 0, platno.width, platno.height);
molivche.fillStyle = "white";
for (var i = 0; i < snejinki.length; i++) {
var s = snejinki[i];
s.y = s.y + s.v;
s.x = s.x + Math.sin(s.y / 30) * 0.5;
if (s.y > platno.height) { s.y = 0; s.x = Math.random() * platno.width; }
molivche.beginPath();
molivche.arc(s.x, s.y, s.r, 0, Math.PI * 2);
molivche.fill();
}
requestAnimationFrame(kadur);
}
kadur();