float x = 100.00;//firefox618
float y = 100.00;
float w = 100.00;
float h = 75.00;
void setup()
{
size(200,200);
}
void draw()
{
background(255);
if((mouseX-x)*(mouseX-x)/((w/2)*(w/2))+(mouseY-y)*(mouseY-y)/((h/2)*(h/2))<1)
{
fill(0);
}else{
fill(175);
}
ellipse(x,y,w,h);
println((mouseX-x)*(mouseX-x)/((w/2)*(w/2)));
println((mouseY-y)*(mouseY-y)/((h/2)*(h/2)));
println(mouseX);
println(mouseY);
}
- 本文固定链接: http://iprocessing.cn/2018/04/04/椭圆按钮ellipse-button/
- 转载请注明: firefox618 于 Processing编程艺术 发表