-
Notifications
You must be signed in to change notification settings - Fork 0
/
logo-spinner.js
78 lines (71 loc) · 1.52 KB
/
logo-spinner.js
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
const { anime } = require("../index.js").default
const line = function (it) {
return ".spinner ." + it
}
const lines = function (it) {
return it.map(line)
}
const T = 450
const timeline = anime.timeline("spinner", {
loop: true,
autoplay: true,
duration: T,
easing: "ease-in-out",
})
const keyframe = function (delay, obj) {
return timeline.add(obj, delay * T)
}
keyframe(0, {
targets: lines(["N-left", "E1-bottom", "E1-right", "W-bottom"]),
strokeDashoffset: 0,
})
keyframe(1, {
targets: lines(["E1-middle", "E2-middle", "W-middle"]),
strokeDashoffset: 0,
})
keyframe(2, {
targets: lines([
"E1-top",
"E2-bottom",
"W-right",
"N-right",
"E1-left",
"E2-left",
]),
strokeDashoffset: 0,
})
keyframe(3, {
targets: ".spinner",
rotate: "1turn",
duration: 1.5 * T,
})
keyframe(3, {
targets: lines([
"E1-top",
"E2-bottom",
"W-right",
"N-right",
"E1-left",
"E2-left",
]),
strokeDashoffset: 1010,
})
keyframe(4, {
targets: lines(["E1-middle", "E2-middle", "W-middle"]),
strokeDashoffset: 1010,
})
keyframe(4.5, {
targets: lines(["N-left", "E1-bottom", "E1-right", "W-bottom"]),
strokeDashoffset: 1010,
})
console.log(timeline.intoCSS())
// return document.spinnerAnimation = anime({
// targets: lines(['N-left', 'E1-bottom', 'E1-right', 'W-bottom']),
// strokeDashoffset: 0,
// duration: T,
// easing: 'easeInOutSine',
// complete: function(){
// console.log('completed-initial-anim');
// return document.spinnerTimeline.play();
// }
// });