SpaccDotWeb/Example.Server/particles.js

18 lines
623 B
JavaScript

window.addEventListener('load', function(){
for (var i=0; i<(window.innerWidth * window.innerHeight / 6000); i++) (function(){
var v = (Math.random() * window.innerHeight), h = (100 * Math.random());
var n = document.createElement('span');
n.textContent = '✨️';
n.style.position = 'absolute';
document.body.appendChild(n);
var e = setInterval(function(){
var r = Math.random();
n.style.top = (v += 1).toString() + 'px';
n.style.left = (h += (r > 0.7 ? r/5 : -r/5)).toString() + '%';
if (v > window.innerHeight) v = -16;
if (h > 100) h = -2;
else if (h < -2) h = 100;
}, 20);
})();
});