I'm working with the dougtesting.net library to create a spinning wheel. I've been trying to figure out how to reset the animation once it finishes, but I can't seem to find any information on it. My goal is to completely clear all states so that the wheel returns to its original position (as if the startAnimation() function was never called). Can you suggest a solution for this?
let luckyDrawWheel = new Winwheel({
canvasId: "lucky-draw-canvas",
drawText: true,
numSegments: 8,
textAlignment: "inner",
textFontSize: 10,
textMargin: 35,
textFontFamily: "TUV Poetsen One",
imageOverlay: true,
segments: [...],
animation: {
type: "spinToStop",
duration: 5,
spins: 8,
callbackFinished: alertPrize,
},
});
// Function called when the animation finishes.
function alertPrize(indicatedSegment)
{
alert(indicatedSegment.text + ' says Hi');
}
luckyDrawWheel.draw();
const runWheelBtn = document.getElementById("run_wheel");
runWheelBtn.addEventListener("click", () => {
luckyDrawWheel.startAnimation();
});