Question

How to avoid redrawing eveything at each frame in paper.js?

I suppose I have to detach the frame event from the view view.detach('frame');, and then call draw manually every time I want to update something ?

This is very usefull to make drawing applications.


EDIT

Here is an example of what I want to avoid (click to toggle copies visibility): the framerate decreases drastically when I show many other shapes (since everything is redrawn at each frame) but the copies could be drawn only on click and then let untouched (the framerate would be always high).

Just in case: Symbols are not a solutions here, this is maybe a better example of what I want to achieve. The trails are fading away since the canvas is not cleared at each frame, just darkened.

I found some infos about here, it seems redraw optimizations are not implemented yet.

Was it helpful?

Solution

Ok, I implemented the persistence request here, but I didn't pull it yet.

You can check two examples: the tail effect and the performance benchmark (click to toggle visibility of modified clones, press 'space' to toggle persistence). You can find the example code here, under drawings.

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