From bf85779edb694997438bf977ba8dbafb524f1813 Mon Sep 17 00:00:00 2001 From: Meleeman01 Date: Tue, 3 Dec 2024 06:54:13 -0600 Subject: [PATCH] adjusted values to be more precise. about .0026 per step. --- index.html | 56 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index 7674c73..3375d63 100644 --- a/index.html +++ b/index.html @@ -30,33 +30,33 @@ 300, 600, 300, 500, 800, 550, 400, 300, 900, 500, 'spin again', 900, 'Bankrupt', 600, 400, 300 ]; - const wheelSpinSpeedData = [ - {'0':{'lose a turn':0.252}}, - {'1':{'800':.25}}, - {'2':{'350':.247}}, - {'3':{'450':.2445}}, - {'4':{'450':.242}}, - {'5':{'300':.239}}, - {'6':{'600':.2365}}, - {'7':{'5000':.234}}, - {'8':{'300':.2312}}, - {'9':{'600':.2287}}, - {'10':{'300':.226}}, - {'11':{'500':.2235}}, + const wheelSpinSpeedData = { + '0':0.2523,//lose a turn + '1':.2497,//800 + '2':.2471,//350 + '3':.2445,//450 + '4':.2418,//450 + '5':.2392,//300 + '6':.2366,//600 + '7':.2339,//5000 + '8':.2313,//300 + '9':.2287,//600 + '10':.2261,//300 + '11':.2235,//500 - {'12':{'800':.2209}}, - {'13':{'550':.2183}}, - {'14':{'400':.2157}}, - {'15':{'300':.2131}}, - {'16':{'900':.2105}}, - {'17':{'500':.2079}}, - {'18':{'spin again':.2053}}, - {'19':{'900':.2027}}, - {'20':{'Bankrupt':.2000}}, - {'21':{'600':.1974}}, - {'22':{'400':.1947}}, - {'23':{'300':.1921}} - ]; + '12':.2208,//800 + '13':.2182,//550 + '14':.2156,//400 + '15':.213,//300 + '16':.2104,//900 + '17':.2078,//500 + '18':.2052,//spin again + '19':.2026,//900 + '20':.1999,//Bankrupt + '21':.1973,//600 + '22':.1947,//400 + '23':.1921//300 + }; const canvas = document.getElementById('wheelCanvas'); const ctx = canvas.getContext('2d'); const radius = canvas.width / 2; @@ -117,6 +117,8 @@ // Start spinning function startSpin(targetIndex) { console.log('targetIndex: ',targetIndex); + let resultingSpeed = wheelSpinSpeedData[targetIndex]; + console.log('resultingSpeed: ', resultingSpeed); if (spinning) return; rotation = 0 - (.283*6) spinning = true; @@ -127,7 +129,7 @@ console.log(anglePerSegment); let currentRotation = rotation; // Start from the current rotation - spinSpeed = 0.1921; // Initial speed + spinSpeed = wheelSpinSpeedData[targetIndex]; // Initial speed function animate() {