If you want event based updating, you'll need to call redraw()
at the end of your event handlers (before they would return, not literally only at the end of the function definition) so that the draw
function gets called. Don't use loop()
, as that simply turns the automatic next-frame-scheduling code back on (the loop
/noLoop
functions only control whether the sketch should be automatically scheduling frames).
Also, note that using noLoop
with a frameRate
won't do anything. The first voids the second.
Finally, note that frameRate(300)
is insane ;) You're asking Processing to run all your draw code in a fraction over 3 milliseconds. That's not going to happen.