forked from juliangarnier/anime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheasings.html
More file actions
68 lines (64 loc) · 1.53 KB
/
easings.html
File metadata and controls
68 lines (64 loc) · 1.53 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
<!DOCTYPE html>
<html>
<head>
<title>anime.js</title>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="img/favicon.png" />
<link rel="apple-touch-icon" href="img/apple-touch-icon.png" />
<link href="css/styles.css" rel="stylesheet">
<style>
section {
display: flex;
}
.easing {
flex: 1;
position: relative;
width: auto;
height: 100%;
padding: 20vh 4px 4px 4px;
}
.easing div {
width: 2rem;
height: 2rem;
border-radius: 50%;
}
.easing p {
transform: rotate(90deg) translateY(-100%);
transform-origin: 0 50%;
position: absolute;
top: 0;
left: 0;
}
</style>
</head>
<body>
<script src="../anime.js"></script>
<script>
var sectionEl = document.querySelector('section');
var easingList = Object.keys(anime.easings).sort(function(a, b) {
return (a < b) ? -1 : (a > b) ? 1 : 0;
});
function createEaseEl(easeName) {
var el = document.createElement('div');
var ballEl = document.createElement('div');
var textEl = document.createElement('p');
el.classList.add(easeName);
el.classList.add('easing');
ballEl.classList.add('blue');
textEl.innerHTML = easeName;
el.appendChild(ballEl);
el.appendChild(textEl);
document.body.appendChild(el);
anime({
targets: ballEl,
translateY: '74vh',
loop: true,
direction: 'alternate',
duration: 2000,
easing: easeName
});
}
easingList.forEach(createEaseEl);
</script>
</body>
</html>