Browse Source

3.1415926535897932384626433832795028

master
quegzacov 2 years ago
parent
commit
e471ffe0d2
  1. 2
      index.php
  2. 8
      script.js

2
index.php

@ -22,7 +22,7 @@ var_dump($res);
<script type="text/javascript">
draw_roulette(3, 200, 200, 200, ["arthur", "jimmy", "Jamel"]);
</script>
<button onclick="rotate(250)">Tourner</button>
<button onclick="rotate(3)">Tourner</button>
</body>
</html>

8
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);
})

Loading…
Cancel
Save