Browse Source

3.14159265358979323846264338327950

master
quegzacov 2 years ago
parent
commit
5ef510abfd
  1. 2
      index.php
  2. 17
      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="document.getElementById('roulette').setAttribute('transform', 'rotate(90)')" style="transition: 3s ease-out;">Tourner</button>
<button onclick="rotate(250)">Tourner</button>
</body>
</html>

17
script.js

@ -32,3 +32,20 @@ function draw_roulette(nb_person, x, y, r, names){
}
};
function rotate(angle){
return new Promise((resolve, reject) => {
let i = 0;
let interval = setInterval(() => {
if (i >= angle){
document.getElementById('roulette').style.transform = 'rotate('+angle+')';
clearInterval(interval);
resolve()
}
else {
i += 9;
document.getElementById('roulette').style.transform = 'rotate('+i+')';
}
}, 5);
})
};

Loading…
Cancel
Save