How to use matter.js on a web worker?
Opened this issue · 0 comments
TheInvoker commented
I want to use matter.js on a web worker with offscreen canvas, but the problem is it seems to throw errors about requestAnimationFrame. It tries to get it by using window.requestAnimationFrame but in a web worker window is not defined. Also if I try to set a sprite, it fails because matter.js uses new Image() but that isn't defined in a web worker. Also it tries to style the canvas, but that doesn't work since its an offscreen canvas.
Has anyone gotten this to work?