Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use matter.js on a web worker? #1288

Open
TheInvoker opened this issue May 2, 2024 · 0 comments
Open

How to use matter.js on a web worker? #1288

TheInvoker opened this issue May 2, 2024 · 0 comments

Comments

@TheInvoker
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant