2 Train | Interactive code for 2nd week
int num = 40;
int[] x = new int[num];
int[] y= new int[num];
float range=100;
void setup() {
size(800, 800);
noStroke();
}
void draw() {
background(0);
translate(width/2, height/2);
for(int a=10; a<mouseX+mouseY; a+=20){
rotate(5);
strokeWeight(2);
stroke(mouseX/10,mouseY/10,100);
noFill();
rect(20, 20, a, 20);
fill(255,102);
for(int i=0;i<num-1; i++){
x[i]=x[i+1];
y[i]=y[i+1];
}
frameRate(30);
x[num-1]=mouseX+(int)random(-10,10);
y[num-1]=mouseY+(int)random(-10,10);
rect(200+random(-range,range),200+random(-range,range),10,10);
fill(random(0,255),random(0,255),random(0,255),240);
for(int k=0;k<num;k++){
rect(x[k]+random(-range,range),y[k]+random(-range,range),10,10);
fill(random(0,255),random(0,255),random(0,255),240);
}
}
for(int a=10; a<mouseX+mouseY; a+=5){
rotate(.21);
strokeWeight(2);
stroke(149, 242, 250);
noFill();
rect(100, 100, 80, 80);
}
for(int a=10; a<mouseX+mouseY; a+=2){
rotate(.5);
strokeWeight(2);
stroke(250, 255, 15);
noFill();
rect(200, 200, 10, 80);
a=a+2;
}
}
Sorry, the comment form is closed at this time.