My last project extended the rain idea. I made an interactive raincloud that rains and creates thunderbolts.
The ‘rain’ positions are stored in an array, and it draws lines from those stored positions to make the rain.
I think it’s a cute animation, and I want to put some finishing touches on it later.
the noise function doesn’t seem to work on the blog for the way I have it set up, so here is the code.
static int arrMax = 320;
int[] positions1 = new int[arrMax];
int[] positions2 = new int[arrMax];
int index=1;
int trueDex=0;
void setup(){
size(500,500);
smooth();
}
void draw(){
int i=1;
int x, y;
background(150,180,250);
fill(120,120,120);
ellipseMode(CENTER);
noStroke();
triangle(mouseX-25,mouseY+15,mouseX+30,mouseY+15,mouseX,mouseY-10);
ellipse(mouseX+21,mouseY-5,40,40);
ellipse(mouseX-18,mouseY,30,30);
ellipse(mouseX-12,mouseY-23,40,40);
ellipse(mouseX+6,mouseY-20,35,35);
ellipse(mouseX+10,mouseY+14,30,5);
ellipse(mouseX-9,mouseY+14,30,5);
if(frameCount%1==0){
x = positions1[index-1] = mouseX + 35 – int(noise(index)*70);
y = positions1[index] = mouseY + 16;
positions2[index-1] = x + 20;
positions2[index] = y + 30;
index=(index+2)%arrMax;
if(trueDex
static int arrMax = 320;
int[] positions1 = new int[arrMax];
int[] positions2 = new int[arrMax];
int index=1;
int trueDex=0;
void setup(){
size(500,500);
smooth();
}
void draw(){
int i=1;
int x, y;
background(150,180,250);
fill(120,120,120);
ellipseMode(CENTER);
noStroke();
triangle(mouseX-25,mouseY+15,mouseX+30,mouseY+15,mouseX,mouseY-10);
ellipse(mouseX+21,mouseY-5,40,40);
ellipse(mouseX-18,mouseY,30,30);
ellipse(mouseX-12,mouseY-23,40,40);
ellipse(mouseX+6,mouseY-20,35,35);
ellipse(mouseX+10,mouseY+14,30,5);
ellipse(mouseX-9,mouseY+14,30,5);
if(frameCount%1==0){
x = positions1[index-1] = mouseX + 35 - int(noise(index)*70);
y = positions1[index] = mouseY + 16;
positions2[index-1] = x + 20;
positions2[index] = y + 30;
index=(index+2)%arrMax;
if(trueDex