-
Notifications
You must be signed in to change notification settings - Fork 0
/
essais.html
48 lines (42 loc) · 1.19 KB
/
essais.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="essais.css">
<title>Document</title>
</head>
<body>
<div class="hands-container">
<div id="joueur" class="hand-container">
<div class="hand"></div>
</div>
<div id="ordi" class="hand-container">
<div class="hand"></div>
</div>
</div>
<button>Go</button>
<script type="text/javascript">
const handPlayer = document.querySelector('#joueur .hand');
const handOrdi = document.querySelector('#ordi .hand');
const button = document.querySelector('button');
let eltSetBackground = (el, choice)=>{
el.style.backgroundImage = `url(${choice}.png)`;
}
let animeGame = ()=>{
handPlayer.classList.toggle('anime');
handOrdi.classList.toggle('anime');
handPlayer.style.backgroundImage = 'url("pierre2.png")';
handOrdi.style.backgroundImage = 'url("pierre2.png")';
setTimeout(()=>{
handPlayer.classList.toggle('anime');
handOrdi.classList.toggle('anime');
handPlayer.style.backgroundImage = 'url("feuille.png")';
handOrdi.style.backgroundImage = 'url("ciseau.png")';
}, 1500);
}
button.addEventListener('click', (e)=>{
animeGame();
});
</script>
</body>
</html>