A proof-of-concept for paper.js to render on OffscreenCanvas in web worker

133 views
Skip to first unread message

mutsuntsai

unread,
Feb 9, 2021, 7:03:33 PM2/9/21
to Paper.js
For the moment, the way paper.js supports web worker is by means of exportJSON() and importJSON() methods, which are actually quite time consuming. I was trying to find a way to let paper.js render on OffscreenCanvas directly inside a web worker, and I've managed to do just that. Here's my repo to demonstrate how it works.

https://github.com/MuTsunTsai/paper-worker-test

In those browsers where OffscreenCanvas is not supported, it also has a fallback which is still a lot more efficient than exportJSON() and importJSON(). See README of the repo for more details.
Enjoy!
Reply all
Reply to author
Forward
0 new messages