Browse Source

yahou 2

master
alexandre.aboulin 3 years ago
parent
commit
2329432125
  1. 41
      app.js
  2. 6
      index.html

41
app.js

@ -1,19 +1,3 @@
function vw(v) {
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
return (v * w) / 100;
}
window.onresize = () => {
let cubes = document.getElementsByClassName('cube__face')
for (var i = 0; i < 10; i++) {
/*window.getComputedStyle(cubes[i])*/cubes[i].style.transform =
'rotateX('+i*36+'deg) translateZ('+vw(3.4)*Math.tan(18 * Math.PI / 180)+')';
console.log(window.getComputedStyle(cubes[i]).transform)
}
}
let bac = 1000
let joueur = 100
let mise
@ -79,19 +63,14 @@ function regles(){
}
function rotate(rouleau, angle){
let id = null;
let i = 0;
clearInterval(id);
id = setInterval(frame, 5);
function frame() {
if (i >= angle) {
clearInterval(id);
}
let id = setInterval(() => {
if (i >= angle) clearInterval(id);
else {
i += 9;
rouleau.style.transform = 'rotate3d(1,0,0,'+i+'deg)';
}
}
}, 5);
// let i = 1;
// let interval = setInterval(() => {
// if(i >= angle) {
@ -108,3 +87,17 @@ function tirage(){
rotate(document.getElementsByClassName("cube")[2], Math.floor(Math.random() * 15)*360+nbAlea())
}
tirage()
function vw(v) {
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
return (v * w) / 100;
}
window.onresize = () => {
let cubes = document.getElementsByClassName('cube__face')
for (var i = 0; i < 10; i++) {
/*window.getComputedStyle(cubes[i])*/cubes[i].style.transform =
'rotateX('+i*36+'deg) translateZ('+vw(3.4)*Math.tan(18 * Math.PI / 180)+')';
console.log(window.getComputedStyle(cubes[i]).transform)
}
}

6
index.html

@ -61,5 +61,11 @@
<input type="text" id="mise_input">
<button id="lancer" onclick="jeu()">Lancer</button>
<script src="app.js"></script>
<div class="regles">
<div class="regles-container">
Règles
</div>
</div>
</body>
</html>

Loading…
Cancel
Save