adjusted values to be more precise. about .0026 per step.
This commit is contained in:
parent
31637dc5c2
commit
bf85779edb
56
index.html
56
index.html
@ -30,33 +30,33 @@
|
|||||||
300, 600, 300, 500, 800, 550, 400, 300, 900, 500, 'spin again',
|
300, 600, 300, 500, 800, 550, 400, 300, 900, 500, 'spin again',
|
||||||
900, 'Bankrupt', 600, 400, 300
|
900, 'Bankrupt', 600, 400, 300
|
||||||
];
|
];
|
||||||
const wheelSpinSpeedData = [
|
const wheelSpinSpeedData = {
|
||||||
{'0':{'lose a turn':0.252}},
|
'0':0.2523,//lose a turn
|
||||||
{'1':{'800':.25}},
|
'1':.2497,//800
|
||||||
{'2':{'350':.247}},
|
'2':.2471,//350
|
||||||
{'3':{'450':.2445}},
|
'3':.2445,//450
|
||||||
{'4':{'450':.242}},
|
'4':.2418,//450
|
||||||
{'5':{'300':.239}},
|
'5':.2392,//300
|
||||||
{'6':{'600':.2365}},
|
'6':.2366,//600
|
||||||
{'7':{'5000':.234}},
|
'7':.2339,//5000
|
||||||
{'8':{'300':.2312}},
|
'8':.2313,//300
|
||||||
{'9':{'600':.2287}},
|
'9':.2287,//600
|
||||||
{'10':{'300':.226}},
|
'10':.2261,//300
|
||||||
{'11':{'500':.2235}},
|
'11':.2235,//500
|
||||||
|
|
||||||
{'12':{'800':.2209}},
|
'12':.2208,//800
|
||||||
{'13':{'550':.2183}},
|
'13':.2182,//550
|
||||||
{'14':{'400':.2157}},
|
'14':.2156,//400
|
||||||
{'15':{'300':.2131}},
|
'15':.213,//300
|
||||||
{'16':{'900':.2105}},
|
'16':.2104,//900
|
||||||
{'17':{'500':.2079}},
|
'17':.2078,//500
|
||||||
{'18':{'spin again':.2053}},
|
'18':.2052,//spin again
|
||||||
{'19':{'900':.2027}},
|
'19':.2026,//900
|
||||||
{'20':{'Bankrupt':.2000}},
|
'20':.1999,//Bankrupt
|
||||||
{'21':{'600':.1974}},
|
'21':.1973,//600
|
||||||
{'22':{'400':.1947}},
|
'22':.1947,//400
|
||||||
{'23':{'300':.1921}}
|
'23':.1921//300
|
||||||
];
|
};
|
||||||
const canvas = document.getElementById('wheelCanvas');
|
const canvas = document.getElementById('wheelCanvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
const radius = canvas.width / 2;
|
const radius = canvas.width / 2;
|
||||||
@ -117,6 +117,8 @@
|
|||||||
// Start spinning
|
// Start spinning
|
||||||
function startSpin(targetIndex) {
|
function startSpin(targetIndex) {
|
||||||
console.log('targetIndex: ',targetIndex);
|
console.log('targetIndex: ',targetIndex);
|
||||||
|
let resultingSpeed = wheelSpinSpeedData[targetIndex];
|
||||||
|
console.log('resultingSpeed: ', resultingSpeed);
|
||||||
if (spinning) return;
|
if (spinning) return;
|
||||||
rotation = 0 - (.283*6)
|
rotation = 0 - (.283*6)
|
||||||
spinning = true;
|
spinning = true;
|
||||||
@ -127,7 +129,7 @@
|
|||||||
console.log(anglePerSegment);
|
console.log(anglePerSegment);
|
||||||
|
|
||||||
let currentRotation = rotation; // Start from the current rotation
|
let currentRotation = rotation; // Start from the current rotation
|
||||||
spinSpeed = 0.1921; // Initial speed
|
spinSpeed = wheelSpinSpeedData[targetIndex]; // Initial speed
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user