Week 2 Sketch/Animation

  • Show Code
/**@peep sketch */
float x=0;
float y=0;
 
void setup(){
size (800, 800);
}
void draw(){
background (random(255), random(255), random(255));
stroke(random(100));
strokeWeight(25);
fill(255,0,0);
line(x, y, x, y);
strokeWeight(15);
fill(255,0,0);
line(x+100, y+100, x+100, y+100);
line(x+200, y+200, x+200, y+200);
line(x+300, y+300, x+300, y+300);
line(x+400, y+400, x+400, y+400);
strokeWeight(15);
fill(255, 0, 255);
rectMode(CORNER);
rect(x+1, y+1, x+1, y+1);
fill(255, 0, 0);
strokeWeight(15);
ellipse(x, y, x, y);
if (++x > 400) {x= -80;}
if (++y > 400) {y= -80;}
if (x < -1) {background(random(255), random(255), random(255));}
if (y < -1) {background(random(255), random(255), random(255));}
fill(255, 0);
rect(0,0,width,height);
}