-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathanime.html
76 lines (70 loc) · 1.96 KB
/
anime.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<style>
html,
body {
padding: 0;
margin: 0;
background-color: #25275a;
width: 100%;
height: 100%;
}
.box {
width: 50px;
height: 150px;
}
.boxes {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.boxes__inner {
display: flex;
overflow: hidden;
height: 165px;
}
</style>
<script src="node_modules/animejs/lib/anime.min.js"></script>
<title>Anime</title>
</head>
<body>
<div class="boxes">
<div class="boxes__inner">
<div class="box js-box"></div>
<div class="box js-box"></div>
<div class="box js-box"><h1>D</h1></div>
<div class="box js-box"><h1>E</h1></div>
<div class="box js-box"><h1>V</h1></div>
<div class="box js-box"></div>
<div class="box js-box"><h1>O</h1></div>
<div class="box js-box"><h1>P</h1></div>
<div class="box js-box"><h1>S</h1></div>
<div class="box js-box"></div>
<div class="box js-box"></div>
</div>
</div>
<script>
const boxesAnimation = window.anime({
targets: '.js-box',
translateY: [150, 50],
backgroundColor: (el, i, t) => {
const r = 58 + (i * 12);
const g = 35 + (i * 12);
const b = 220;
const color = `rgb(${r}, ${g}, ${b})`;
return color;
},
duration: 900,
easing: 'easeOutElastic',
elasticity: 500,
delay: (el, i, t) => i * 20,
loop: true,
direction: 'alternate',
});
</script>
</body>
</html>