|
@ -33,18 +33,20 @@ function draw_roulette(nb_person, x, y, r, names){ |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rotate(angle){ |
|
|
function rotate(nb_person){ |
|
|
|
|
|
let angle = Math.floor(Math.random()*15)*360 + (Math.random()*nb_person)*360/nb_person; |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
let i = 0; |
|
|
let i = 0; |
|
|
let interval = setInterval(() => { |
|
|
let interval = setInterval(() => { |
|
|
if (i >= angle){ |
|
|
if (i >= angle){ |
|
|
document.getElementById('roulette').style.transform = 'rotate('+angle+')'; |
|
|
document.getElementById('roulette').style.transform = 'rotate('+angle+'deg)'; |
|
|
clearInterval(interval); |
|
|
clearInterval(interval); |
|
|
resolve() |
|
|
resolve() |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
i += 9; |
|
|
i += 9; |
|
|
document.getElementById('roulette').style.transform = 'rotate('+i+')'; |
|
|
console.log(i); |
|
|
|
|
|
document.getElementById('roulette').style.transform = 'rotate('+i+'deg)'; |
|
|
} |
|
|
} |
|
|
}, 5); |
|
|
}, 5); |
|
|
}) |
|
|
}) |
|
|