canvas-sketch icon indicating copy to clipboard operation
canvas-sketch copied to clipboard

Render on demand

Open edap opened this issue 5 years ago • 2 comments

It would be nice if there would be a possibility to add rendering on demand through a callback. Is there a way to make a custom render method, where the requestAnimationFrame function is available?

edap avatar Jun 08 '20 13:06 edap

I’ve also wanted this feature at times. What I tend to do is run the async canvasSketch function, then stop() the SketchManager instance that gets returned, and manually call render() and resize() functions as needed.

mattdesl avatar Sep 01 '20 22:09 mattdesl

Actually - simpler would just be to set animate to true and playing to false in the settings. No need to stop that way or worry about resize, and you can call props.render() from within your sketch to trigger a new render manually.

mattdesl avatar Sep 01 '20 22:09 mattdesl