CODE
void setup(){
size(240,250);
background(0);
int x = 50;
int y = 0;
textSize(100);
//ตัวอักษรM
fill(150,247,72);
text("M",40+x,115+y);
//ตัวอักษรS
fill(255,255,108);
text("S",40+x,220+y);
//ตัวอักษรC
fill(300,200,100);
text("C",130+x,220+y);
//ตัวโน๊ตUและI
noStroke();
fill(255,108,197);
ellipse(140+x,51+y,25,20);
ellipse(185+x,51+y,25,20);
fill(108,165,255);
ellipse(120+x,159+y,25,20);
strokeWeight(8);
stroke(255,108,197);
fill(255,108,197);
line(130+x,50+y,130+x,112+y);
rect(130+x,100+y,45,12);
line(175+x,50+y,175+x,112+y);
stroke(108,165,255);
line(110+x,158+y,110+x,218+y);
}
size(240,250);
background(0);
int x = 50;
int y = 0;
textSize(100);
//ตัวอักษรM
fill(150,247,72);
text("M",40+x,115+y);
//ตัวอักษรS
fill(255,255,108);
text("S",40+x,220+y);
//ตัวอักษรC
fill(300,200,100);
text("C",130+x,220+y);
//ตัวโน๊ตUและI
noStroke();
fill(255,108,197);
ellipse(140+x,51+y,25,20);
ellipse(185+x,51+y,25,20);
fill(108,165,255);
ellipse(120+x,159+y,25,20);
strokeWeight(8);
stroke(255,108,197);
fill(255,108,197);
line(130+x,50+y,130+x,112+y);
rect(130+x,100+y,45,12);
line(175+x,50+y,175+x,112+y);
stroke(108,165,255);
line(110+x,158+y,110+x,218+y);
}
จากรูปถ้ามีการเปลี่ยนค่าของตัวแปรx และy จะทำให้รูปเปลี่ยนตำแหน่งได้ตามค่าของตัวแปรx และy
ตัวอย่าง
ให้ค่าของตัวแปร x = 50 y = 0
ให้ค่าตัวแปร x = 0 y = 50
ให้ค่าตัวแปร x = 50 y = 50
ไม่มีความคิดเห็น:
แสดงความคิดเห็น