function createSnowFlake() { const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); snowFlakeInner.setAttribute("href", "/symbols.svg#icon-asterisk"); snowFlake.classList.add("o-icon"); snowFlake.classList.add("o-icon--snow"); snowFlake.ariaHidden = true; snowFlake.style.width = Math.random() * 10 + 10 + 'px'; snowFlake.style.left = Math.random() * window.innerWidth + 'px'; snowFlake.style.animationDuration = Math.random() * 3 + 2 + 's'; snowFlake.style.opacity = Math.random(); snowFlake.appendChild(snowFlakeInner); document.body.appendChild(snowFlake); setTimeout(() => { snowFlake.remove(); }, 5000); } window.addEventListener("load", () => { setInterval(createSnowFlake, 100); })