Question

The onFrame event handler is not called as soon as my canvas is off the screen (when I animate it toward outside the screen, the handler stops being called exactly when the canvas is outside the screen).

Is there a way to keep calling the event handler even when the canvas outside the screen or not displayed?

I want to render it to a three.js texture.

I solved my problem using paper.view.draw() in a timer with setInterval(), but is there another proper solution ?

Was it helpful?

Solution

That's part of an optimization that we implemented in order to keep CPU load down. You can turn this behavior off by setting this attribute on the canvas: keepalive="true" or: data-paper-keepalive="true"

OTHER TIPS

All onFrame callbacks are halted when their view is out of the viewable area of the browser. The code that handles this is in the handleCallbacks() function of DomEvent.requestAnimationFrame. You could setup your own override there, just as the keepalive canvas attribute overrides halting background animations.

However, my guess is that setting up a setInterval() timer like you have already is probably the cleanest way to implement what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top