samedi 7 mai 2011

Timer considerations

This links shows how easy everything becomes in Object Oriented Programming:
http://www.learningprocessing.com/examples/chapter-10/example-10-5/

But this example when used with mousePressed (for example) has a flaw: the timer.isFinished() is always true when the timer is not started immediately.

So we added a stop() function for the timer, and now timer.isFinished() is also false so long as the timer is not started.

You can find the sketch here: http://www.contrechoc.com/crosslab/timerOO/applet/timerOO.html

When you click in the sketch square you see the background change after 3 seconds.


This is a good example to see the power of objects.

Aucun commentaire:

Enregistrer un commentaire