xxxxxxxxxx
ArrayList<Snowflake> storm = new ArrayList<Snowflake>();
void setup(){
fullScreen();
for(int count = 0; count < 500; count = count + 1){
storm.add(new Snowflake());
}
}
void draw(){
background(0,0,30);
for(Snowflake currentSnowflake : storm){
currentSnowflake.render();
}
}
class Snowflake{
color myColor;
float xSpeed;
float ySpeed;
float size;
float xPos;
float yPos;
Snowflake(){
xPos = random(width);
yPos = random(height);
xSpeed = random (-3,3);
ySpeed = random (1,5);
size = random (5,20);
myColor = color(random(255), random(255), random(255));
}
void render(){
fill(255,255,255);
ellipse(xPos, yPos, size, size);
yPos = yPos + ySpeed;
xPos = xPos + xSpeed;
if(yPos > height) yPos = 0;
if(xPos < 0) xPos = width;
if(xPos > width) xPos = 0;
}
}