-
Notifications
You must be signed in to change notification settings - Fork 0
/
hopperAnimation.html
73 lines (68 loc) · 1.6 KB
/
hopperAnimation.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
<style>
#logo {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.logo-letter {
width: max-content;
font-size: 44px;
}
.jump {
animation-duration: 2s;
animation-iteration-count: 1;
animation-direction: forwards;
transform-origin: bottom;
animation-name: bounce;
animation-timing-function: cubic-bezier(0.28, 0.84, 0.42, 1);
}
@keyframes bounce {
0% {
transform: scale(1, 1) translateY(0);
}
10% {
transform: scale(1.1, 0.9) translateY(0);
}
30% {
transform: scale(0.9, 1.1) translateY(-100px);
}
50% {
transform: scale(1.05, 0.95) translateY(0);
}
57% {
transform: scale(1, 1) translateY(-7px);
}
64% {
transform: scale(1, 1) translateY(0);
}
100% {
transform: scale(1, 1) translateY(0);
}
}
</style>
<html>
<body>
<div id="logo">
<span class="logo-letter" onmouseover="jump(this)">H</span>
<span class="logo-letter" onmouseover="jump(this)">O</span>
<span class="logo-letter" onmouseover="jump(this)">P</span>
<span class="logo-letter" onmouseover="jump(this)">P</span>
<span class="logo-letter" onmouseover="jump(this)">E</span>
<span class="logo-letter" onmouseover="jump(this)">R</span>
</div>
</body>
</html>
<script>
const jump = (target) => {
target.classList.add("jump");
target.addEventListener("animationend", () => {
chill(target);
});
};
const chill = (target) => {
target.classList.remove("jump");
};
</script>