xxxxxxxxxx
35
let snowY = [];
function setup() {
createCanvas(500, 500);
for (let i = 0; i < 100; i++) {
snowY[i] = random(height);
}
}
function draw() {
background("skyblue");
noStroke();
rect(0, height - 50, width, 50);
fill("green");
triangle(400, 150, 350, 250, 450, 250);
triangle(400, 200, 340, 300, 460, 300);
triangle(400, 250, 325, 350, 475, 350);
triangle(400, 300, 310, 400, 490, 400);
fill("brown");
rect(375, 400, 50, 50);
fill("white");
for (let i = 0; i < snowY.length; i++) {
let snowX = (width * i) / snowY.length;
circle(snowX, snowY[i], (i * 10) % 30);
snowY[i] = snowY[i] + 5;
if (snowY[i] > height) {
snowY[i] = 0;
}
}
}