square

by Indi Mansfield
  • Show Code
/**@peep sketch */
int strokeX;
int strokeY;
int green;
int red;
int blue;
void setup(){
    size(400,400);
    background(224,255,255);
    noFill();
    rect(50,50,300,300);
    strokeX = 50;
    strokeY = 51;
    green = 191;
    blue = 255;
    red = 0;
}
void draw(){
    if(strokeX == 50 && strokeY  < 350){
        strokeY ++;
    }
    else if (strokeY == 350 && strokeX < 350){
        strokeX ++;
    }
    else if(strokeX == 350 && strokeY <= 350 && strokeY >= 50){
        strokeY --;
    }
    else if(strokeY <= 50 && strokeX <= 350){
        strokeX --;
    }
    stroke(red,blue,green);
    line(200,200,strokeX,strokeY);
    red ++;
    green --;
    blue ++;
    if(red >= 200){
       red = 0;
    }
    if (green <= 20){
      green = 255;
    }
}

Comments

Nobody has said anything yet.