input:
//运用鼠标触发事件发生
int x;
void setup(){
size(600,400);
}
void draw(){
background(0);
fill(255,34,100);
ellipse(x,200,24,24);
if (mousePressed){ //按住鼠标才能运行事件
x = x + 2;
}
}
void mousePressed(){
}
output:
processing鼠标控制事件
input:
//运用鼠标触发事件发生
int x;
void setup(){
size(600,400);
}
void draw(){
background(0);
fill(255,34,100);
ellipse(x,200,24,24);
if (mousePressed){ //按住鼠标才能运行事件
x = x + 2;
}
}
void mousePressed(){
}
output:
processing鼠标控制事件