Repository navigation
SpinWheelNames — a canvas wheel built with SvelteKit #19230
heyiamluke
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone — I'm Luke, and I built SpinWheelNames, a browser-based wheel for picking names, classroom activities and giveaways. It's free to use and no account is needed. For transparency, the regular pages show Google AdSense ads.
The wheel is drawn on an HTML5 canvas. SvelteKit is a good fit for the surrounding interface: editing entries, changing colours and options, and showing the result, while the canvas handles the animated wheel. I like that this lets me use ordinary browser drawing APIs without making the whole interface imperative. The app uses
@sveltejs/adapter-node; the random stopping position is decided client-side, not by the Node server.The part I'd particularly like feedback on is how I explain and test fairness. Spins use
crypto.getRandomValues, and the entry beneath the pointer when the wheel stops wins. Equal slices have equal chances; weighted entries occupy proportionally larger slices.I also built a fairness test that runs the wheel's own selection logic 100,000 times in the browser, without animating the spins, then displays the counts and a chi-squared result. It starts each spin where the previous one ended rather than resetting the wheel for every trial.
If you've built canvas-heavy interfaces in Svelte, I'd welcome feedback on that balance between a declarative UI and an imperative drawing surface — and whether the fairness explanation is understandable without a statistics background.
Luke
All reactions