|
|
|
|
|
by Klathmon
3397 days ago
|
|
As the other commenter said, you are right that you can't work with canvas in the worker, but you can work directly with the array of image data which you'd often need to anyway for much processing. I saw a library a while ago that was trying to re-implement the canvas primitives using only typed arrays so it was worker safe but I'm not sure what happened to it. |
|
- This might lead to the odd jaggy artifact because I'm rotating bitmaps rather than vectors,
- It might not speed things up that much because I still need to create images from these arrays,
- It starts to seem like quite a lot of work; maybe I'd be better off reducing the number of images slightly, and compensating by speeding up the minimum angular velocity.
You can see what I'm up against at https://arcade.ly/games/asteroids/. (Also, see my comment above, where I've made substantially the same points.)