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