點選滑鼠左右鍵,觸發事件
void setup(){
size (800,800);
noStroke();
background(255);
// fill(0,102,153,204);
rectMode(CENTER);
}
void draw(){
if(mousePressed && (mouseButton == LEFT)) {
fill(0,102,153,204);
rect(width-mouseX,height-mouseY,50,50);
rect(mouseX,mouseY,50,50);
}
if(mousePressed && (mouseButton == RIGHT)){
fill(102,102,153,204);
ellipse(width-mouseX,height-mouseY,50,50);
ellipse(mouseX,mouseY,50,50);
}
}
沒有留言:
張貼留言