CrazyTim / spin-wheel

An easy to use, themeable component for randomising choices and prizes.
https://crazytim.github.io/spin-wheel/examples/themes
MIT License
216 stars 59 forks source link

Need smooth animation of canvas #21

Open macdelacruz opened 1 year ago

macdelacruz commented 1 year ago

Imagine 2000 items in the wheel. Although items are tiny, you can't get the wheel to spin smoothly. It looks lagging, as if it jumps several items ahead of the pointer.

CrazyTim commented 1 year ago

Hi @macdelacruz,

I'm not sure 2000 or even 200 items is a good use case for a wheel? A roulette wheel has about 40. Why so many?

Having said that, the wheel does make a lot of canvas calls on each frame, which can probably be optimised. I noticed a drop in FPS at around 100 items. This was on an intel 2.4GHz with integrated graphics. It would be great if the number of items didn't affect performance, and this might be worth looking into for lower-end devices.

Note: If I set the labels to empty string (not rendered), then there was no drop in FPS on my machine up to 2000 items, so it looks like the text rendering takes a huge toll.

Note: The items didn't render at all if there was over 25k items. Which is interesting I guess 😄