From 0b67c5c2f6d615c7ba36c7d6237cb127a937bf06 Mon Sep 17 00:00:00 2001 From: "alexandre.aboulin" Date: Thu, 24 Mar 2022 09:51:49 +0100 Subject: [PATCH] yahou --- app.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index d486636..0c0ffa0 100644 --- a/app.js +++ b/app.js @@ -18,9 +18,13 @@ function jeu(){ } joueur -= mise bac += mise + + let tirage = [2,1,2]//[nbAlea(), nbAlea(), nbAlea()]; tirageDom.innerText = tirage + + let gain_retour = gain(tirage) console.log(gain_retour) bac -= gain_retour @@ -34,7 +38,8 @@ function jeu(){ } function nbAlea(){ - return Math.floor(Math.random()*9); + let multiples = [36,72,108,144,180,216,252,288,324] + return multiples[Math.floor(Math.random()*9)]; } function gain(tirage){ if(tirage[0] == 9 && @@ -55,4 +60,20 @@ function gain(tirage){ } function regles(){ //afficher règles -} \ No newline at end of file +} + +function rotate(rouleau, angle){ + let i = 1; + let interval = setInterval(() => { + if(i >= angle) {clearInterval(interval); rouleau.style.transform = "rotate3d(1, 0, 0, "+angle+"deg)"} + rouleau.style.transform = "rotate3d(1, 0, 0, "+i+"deg)" + i += 5 + }, 1) +} + +function tirage(){ + rotate(document.getElementsByClassName("cube")[0], 4*360+nbAlea()) + rotate(document.getElementsByClassName("cube")[1], 4*360+nbAlea()) + rotate(document.getElementsByClassName("cube")[2], 4*360+nbAlea()) +} +tirage() \ No newline at end of file