是这样吗 你的解释 不是很懂
float x,y,x1,y1,x2,y2;
boolean mouse = false;
void setup() {
size(600,600);
smooth();
strokeWeight(5);
x = mouseX;
y = mouseY;
}
void draw() {
background(0,0,255);
stroke(0);
fill(255);
triangle(0,0,width/2,height,width,0);
stroke(255);
fill(0);
triangle(width/2,0,0,height,width,height);
ellipseMode(CENTER);
if(mouse==true)
{
noStroke();
fill(0,255,0);
ellipse(x1,y2,50,50);
fill(255,0,0);
ellipse(x2,y1,50,50);
x1++;
y1++;
}
else if(mouseX != pmouseX || mouseY != pmouseY)
{
x = pmouseX;
y = pmouseY;
}
}
void mousePressed(){
x1 = x2 = mouseX;
y1 = y2 = mouseY;
mouse = true;
} |