Answer the question
In order to leave comments, you need to log in
Winwheel.js How to calculate on which segment the wheel will stop?
Hello. The point is this. There is a website with a prize wheel. It is logical that we need to give out prizes depending on the quantity, which means keeping records on the server, and giving away prizes from there. We get a random prize. And now we must pass the number (segment on the wheel) to the animation itself.
But here's the difficulty, I can't understand this formula.
let stopAt = (91 + Math.floor((Math.random() * 43)))
Answer the question
In order to leave comments, you need to log in
Read the comment.
// This formula always makes the wheel stop somewhere inside prize 3 at least
// 1 degree away from the start and end edges of the segment.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question