diff --git a/index.php b/index.php index 614c195..393f30f 100755 --- a/index.php +++ b/index.php @@ -22,7 +22,7 @@ var_dump($res); - + diff --git a/script.js b/script.js index cfd5274..6a8d233 100755 --- a/script.js +++ b/script.js @@ -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) => { let i = 0; let interval = setInterval(() => { if (i >= angle){ - document.getElementById('roulette').style.transform = 'rotate('+angle+')'; + document.getElementById('roulette').style.transform = 'rotate('+angle+'deg)'; clearInterval(interval); resolve() } else { i += 9; - document.getElementById('roulette').style.transform = 'rotate('+i+')'; + console.log(i); + document.getElementById('roulette').style.transform = 'rotate('+i+'deg)'; } }, 5); })