-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
53 lines (47 loc) · 1.81 KB
/
script.js
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
49
50
51
52
53
window.addEventListener('load', function () {
const lunch = this.document.getElementById('lunch');
const reload = this.document.getElementById('reload');
const stop = this.document.getElementById('stop');
const svg = this.document.querySelector('svg');
const counterdiv = this.document.getElementById('downnumber');
const fire = this.document.getElementsByClassName('fire');
const circle = this.document.querySelector('circle');
let counterDown = 10;
reload.addEventListener("click",()=>{
this.location.reload();
})
lunch.addEventListener("click",()=>{
lunch.style.display="none";
stop.style.display="block";
const timer = setInterval(function(){
stop.addEventListener("click",()=>{
svg.classList.remove("path");
circle.classList.remove("rockbtn");
lunch.style.display="block";
stop.style.display="none";
counterDown = 10;
clearInterval(timer);
counterdiv.innerHTML = '';
// flightstop(status);
});
if(counterDown > 0){
svg.classList.add("path");
circle.classList.add("rockbtn");
counterdiv.innerHTML = counterDown;
counterDown = counterDown - 1;
}else{
svg.classList.remove("path");
circle.classList.remove("rockbtn");
stop.style.display="none";
reload.style.display="block";
counterdiv.innerHTML = 'Boom!';
clearInterval(timer);
flight();
}
}, 800);
})
function flight(status){
svg.classList.add("move");
//fire.classList.add("move");
}
});