// Classes
class Snow{
    constructor(){
        this.reset();
        this.position[1] = Math.floor(Math.random() * canvas.height * 4 - 5);
    }

    reset(){
        this.position = [Math.floor(Math.random() * canvas.width * 3 - 50),Math.floor(Math.random() * 50 - 5) - 25];
        this.radius = 5;
        this.speed = [Math.floor(Math.random() * 4 - 1) + 1,Math.floor(Math.random() * 5) + 1];
    }
    draw(){
        ctx.beginPath();
        ctx.fillStyle = "white";
        ctx.arc(this.position[0], this.position[1],this.radius, 0,Math.PI*2);
        ctx.fill();
    }
    update(){
        this.position[1] += this.speed[1];
        this.position[0] += this.speed[0];
        this.radius = Math.abs(lerp(5,1, this.position[1] / canvas.height));
        this.draw();

        // Resetting
        if(this.position[1] > canvas.height){
            this.reset();
        }
    }
}

// Varaibles
var allSnow = [];

// Functions
function _createSnow(){
    for(var i = 0; i < 1500; i++){
        allSnow.push(new Snow());
    }
}
function _drawSnow(){
    for(var i = 0; i < allSnow.length; i++){
        allSnow[i].update();
    }
}

_createSnow();