xxxxxxxxxx
ArrayList < Particle > Weather = new ArrayList < Particle > ();
int tick;
void setup() {
fullScreen();
background(184, 208, 247);
}
void draw() {
fullScreen();
Weather.add(0, new Particle());
for (Particle v: Weather) {
v.render();
}
// landscape
fill(230, 230, 230);
ellipse(width / 3.4, 0 + sin(tick / 15) * 15, width / 1.5, 230);
ellipse(width - 300, 50 + cos(tick / 20) * 15, width / 2, 275);
tick++;
}
class Particle {
float xPos, yPos, zPos, xVel, yVel, zVel;
Particle() {
xPos = random(width);
yPos = 150;
zPos = random(5);
xVel = random(-2, 2);
yVel = random(3, 6);
zVel = random(-0.2, 0.2);
}
void render() {
noStroke();
fill(155, 155, 255, zPos * 5 + 100);
ellipse(xPos, yPos, 5 * zPos / 3, 9 * zPos / 3);
xPos += xVel;
yPos += yVel;
zPos += zVel;
yVel += 0.1;
if (yPos >= height) {xVel *= 0.6655; yVel *= -0.6655; zVel *= 0.2;}
}
}