【发布时间】:2020-05-31 09:43:20
【问题描述】:
我正在制作关于处理的动画。然后,我有一个关于灯的问题。通常,我的代码更长。不过,我做了一个简单的代码,对初学者也很有用。
void setup()
{
size(400, 400, P3D);
noStroke();
}
void draw()
{
background(0);
if (mousePressed) { // lights should work if the mouse pressed on the sphere
lights(); // It should continue till press again on the sphere
} // If the mouse pressed again on the sphere, lights should close
translate(200,200,0); // translate the sphere to the middle of window
sphere(100); // making a sphere for see ligts
}
所以,正如您在 cmets 上看到的那样。如果鼠标按在球体上,灯应该工作,它应该继续工作,直到鼠标再次按在球体上。然后,如果鼠标按在球体上,它应该关闭灯。它应该一次又一次地继续工作。如果你知道怎么做。不客气。谢谢。
【问题讨论】:
标签: java processing