-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.html
More file actions
95 lines (94 loc) · 2.11 KB
/
Copy pathbutton.html
File metadata and controls
95 lines (94 loc) · 2.11 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.wrap {
width: 300px;
height: 300px;
border-radius: 50%;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
background-color: rgba(244, 244, 244);
}
.line {
width: 200px;
height: 10px;
border-radius: 10px;
background-color: rgb(111, 179, 232);
}
.item1 {
animation: down 1s infinite alternate;
animation-play-state: paused;
}
.item2 {
animation: disappear 1s infinite alternate;
animation-play-state: paused;
}
.item3 {
animation: top 1s infinite alternate;
animation-play-state: paused;
}
@keyframes top {
from {
transform: translateY(0) rotate(0);
}
50% {
transform: translateY(-100px) rotate(0);
}
to {
transform: translateY(-100px) rotate(45deg);
}
}
@keyframes down {
from {
transform: translateY(0) rotate(0);
}
50% {
transform: translateY(100px) rotate(0);
}
to {
transform: translateY(100px) rotate(-45deg);
}
}
@keyframes disappear {
from {
opacity: 1;
}
50% {
opacity: 0;
}
to {
opacity: 0;
}
}
</style>
</head>
<body>
<div class="wrap">
<div class="line item1"></div>
<div class="line item2"></div>
<div class="line item3"></div>
</div>
<script>
let wrap = document.querySelector('.wrap')
wrap.addEventListener('click', (e) => {
let lines = document.querySelectorAll('.line')
lines.forEach((item) => {
item.style.animationPlayState = 'running'
})
})
wrap.addEventListener('animationiteration', (evt) => {
let lines = document.querySelectorAll('.line')
lines.forEach((item) => {
item.style.animationPlayState = 'paused'
})
})
</script>
</body>
</html>