const flakeImages = ["snowflake.svg", "snowflake2.svg"];

function snow() {
    let flake = document.createElement("img");
    flake.src = flakeImages[Math.floor(Math.random() * flakeImages.length)];
    document.getElementById("snow").appendChild(flake);
    let temps = Math.random() * 2500 + 2500;
    flake.style.animationDuration = temps / 1000 + "s";
    flake.style.transform = "scale(" + (Math.random() * 0.5 + 0.6) + ")";
    flake.style.left = Math.random() * 100 + "vw";
    setTimeout(() => {
        flake.parentNode.removeChild(flake);
    }, temps);
    setTimeout(snow, 500 * Math.random());
}

snow();