Sunday, August 30, 2015

Lab2 - Positive Sign (function)

//Positive Sign
int posX = 0;
int posY = 150;
int stretch;
    
void setup(){
     size(400, 400);
     frameRate(10);
    }
    
void draw(){
    background(#FFFFFF);    
    stretch=100;   
    draw_positive();

    }
void draw_positive(){
    posX = (posX+5)%width;
    noStroke();
    fill(237, 32, 36);
    //horizontal rect
    rect(posX, posY, (stretch*2), stretch);
    //vertical rect
    rect(posX+(stretch/2), posY-(stretch/2), stretch, (stretch*2));
    }

No comments:

Post a Comment