วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558
lab 4 song
int mx = 10;
void setup() {
size(300, 300);
}
void draw() {
background(204, 102, 0);
draw_song(mx);
movesquaresong(mx);
mx = mx+1;
if (mx==300) {
mx = 10;
}
if (mx>100 && mx<200) {
fill(255,0,0);
} else if (mx<100 && mx>200) {
fill(255);
}
float x=0;
int y=0;
float step=10;
while (x < mouseX) {
line(x, mouseX, width/2, y);
x = x + step;
}
}
void draw_song(int x) {
background(204, 102, 0);
textSize(60);
text("T", 30, 55);
textSize(60);
text("A", 60, 55);
textSize(60);
text("Y", 90, 55);
textSize(60);
text("L", 130, 55);
textSize(60);
text("O", 160, 55);
textSize(60);
text("R", 210, 55);
textSize(60);
text("S", 60, 125);
textSize(60);
text("W", 95, 125);
textSize(60);
text("I", 150, 125);
textSize(60);
text("F", 160, 125);
textSize(60);
text("T", 200, 125);
fill(0);
textSize(20);
text("BEGIN AGAIN", 30, 170);
}
void movesquaresong(int x) {
fill(c1);
rect (x, 200, 50, 50);
}
float c1;
void mousePressed(){
c1=random(0,255);
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น