30 สิงหาคม 2558

Lab2 Positive Sign (Function)







float move = 0;
float size_draw=80;

void setup() {
frameRate(30);
size(400, 200);
background(#FCFAD3);
rectMode(CENTER);
}

void draw() {
Positive_Sign(move);
float end_point = width-(size_draw*0.6)-(width/2);
move = (move+2)%width;
if (move>end_point) {
move=-end_point;
}
}



void Positive_Sign(float pos_x) {
//----- Circle 1 -----//
background(#FCFAD3);
noStroke();
fill(0);
ellipse(pos_x+width/2, height/2, size_draw*1.2, size_draw*1.2);

//----- Circle 2 -----//
stroke(#48494C);
strokeWeight((((size_draw*1.2)-size_draw)/2)*0.32);
ellipse(pos_x+width/2, height/2, size_draw*1.1, size_draw*1.1);

//----- Circle 3 -----//
noStroke();
fill(#FD3A3B);
ellipse(pos_x+width/2, height/2, size_draw, size_draw);

//----- Positive Sign -----//
fill(255);
rect(pos_x+width/2, height/2, size_draw*0.8, size_draw*0.2, size_draw*0.02); //Horizontal Rectangle
rect(pos_x+width/2, height/2, size_draw*0.2, size_draw*0.8, size_draw*0.02); //Vertical Rectangle
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น