How to trigger programmaticaly the draw method of a sketch in 'instance' mode?


I just want to use noLoop() in setup and therefore call only once the draw method but I want to update (to draw again) the sketch in some circumstances.

What's the best advice to achieve this?

I saw that in 'instance' mode it is needed a function f(sketch) that inside defines sketch.setup and sketch.draw and returns nothing.

I intend to define inside a function, let's say drawMethod and make the sketch.draw = drawMethod and finally return an object { draw: drawMethod } in order to expose the method to the outside world and be able to be called later.

I'm not sure if this is the recommended way or not.

Kind regards,

Radu Mirescu


Sign In or Register to comment.