-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathAdvanced Dancing Animation.html
125 lines (112 loc) · 2.89 KB
/
Advanced Dancing Animation.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Dancing Animation</title>
<style>
/* Keyframes for the dance animation */
@keyframes dance-move {
0%, 100% {
transform: rotate(0deg) translateY(0);
}
25% {
transform: rotate(-10deg) translateY(-10px);
}
50% {
transform: rotate(0deg) translateY(0);
}
75% {
transform: rotate(10deg) translateY(-10px);
}
}
@keyframes arm-move {
0%, 100% {
transform: rotate(0deg);
}
50% {
transform: rotate(20deg);
}
}
@keyframes leg-move {
0%, 100% {
transform: rotate(0deg);
}
50% {
transform: rotate(-20deg);
}
}
/* Container for the character */
.character {
position: relative;
width: 100px;
height: 200px;
margin: 100px auto;
animation: dance-move 1s infinite;
}
/* Head of the character */
.head {
width: 60px;
height: 60px;
background-color: #FFD700;
border-radius: 50%;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
/* Body of the character */
.body {
width: 30px;
height: 80px;
background-color: #4CAF50;
position: absolute;
top: 60px;
left: 50%;
transform: translateX(-50%);
}
/* Arms of the character */
.arm {
width: 20px;
height: 60px;
background-color: #4CAF50;
position: absolute;
top: 60px;
transform-origin: top;
animation: arm-move 1s infinite;
}
.arm-left {
left: 0;
}
.arm-right {
right: 0;
}
/* Legs of the character */
.leg {
width: 20px;
height: 80px;
background-color: #4CAF50;
position: absolute;
top: 140px;
transform-origin: top;
animation: leg-move 1s infinite;
}
.leg-left {
left: 20px;
}
.leg-right {
right: 20px;
}
</style>
</head>
<body>
<div class="character">
<div class="head"></div>
<div class="body"></div>
<div class="arm arm-left"></div>
<div class="arm arm-right"></div>
<div class="leg leg-left"></div>
<div class="leg leg-right"></div>
</div>
</body>
</html>