Writing on sand

It is a know issue that many vectors slow down eventually. The answer is to do Blitting. Even a single graphic with lots of vectors in it will eventually slow unless these are no longer stored - by using blitting.

2 Likes

Thank you very much for your help. It is faster with Blit. There is no performance without cache.

3 Likes

I also added an erase feature to the code. Maybe it will be useful to others.

var erase=false

pen.on("drawing", ()=>{
    pen.paper.updateCache(erase?"destination-out":"source-over");
});

Adding two more buttons, one for drawing and the other for deleting, when the delete button is touched, it deletes when erase=true is set.

2 Likes