SVG arcs
Slices from sin and cos
Decay
Speed eased to zero, not timed
N slices
Wheel rebuilt from your input
Overview
Give it a number of choices and a label for each, and it draws a wheel and picks one. Small enough to finish in an evening, and the kind of thing that is only easy until you try it.
There is no wheel image and no chart library. Each slice is an SVG arc path computed from its start and end angle with sine and cosine, and each label is placed and rotated on the same maths. The spin is a speed value decaying toward zero rather than a fixed animation, so the wheel eases to a stop the way a real one does, and the winner is read off the final angle — normalised back into range, because a wheel that has turned nine times is still pointing somewhere specific.
What it does
- 01Choose how many options you want, then label each one
- 02Slice geometry computed per segment as SVG arc paths from sine and cosine
- 03Labels positioned and rotated along their own slice angle
- 04A spin that starts at a randomised speed and decays, rather than running a fixed animation
- 05Winner resolved from the normalised final angle, whatever the wheel's total rotation
