I was working on an animation on processing. Then, I have a question about the lights. Normally, my code is more long. However, I made a simple code which can usefull also for the beginners.
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
}
So, as you can see on the comments. If the mouse pressed on the sphere the lights should work and it should keep working till the mousepressed again on the sphere. Then, if mouse pressed on the sphere it should close the lights.It should keep working again and again. If you know how to make it. You are welcome. Thanks.