-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimations.js
87 lines (76 loc) · 2.28 KB
/
animations.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
79
80
81
82
83
84
85
86
87
//Creating a grid
var screenWidth = window.innerWidth;
var screenHeight = window.innerHeight;
var dotWidth = document.getElementById("dot").offsetWidth;
var rows = Math.round(screenWidth / dotWidth);
var columns = Math.round(screenHeight / dotWidth);
var numDots = rows * columns;
var rowcol = rows + " keer " + columns + " is " + numDots;
var dots = "<div class='dot'></div>";
function fillDots(){
console.log(dotWidth);
document.getElementById("dotContainer").innerHTML= "<div class='dot'></div>".repeat(numDots);
}
fillDots();
//make the grid ripple from the center
var rippleMiddle = {
targets: '.dots-layout .dot',
backgroundColor: '#FFF',
loop: 'false',
opacity: [
{value: 0, easing: 'easeOutSine', duration: 100},
{value: 0.8, easing: 'easeInOutQuad', duration: 100}
],
delay: anime.stagger(100, {grid: [rows, columns], from: 'center'}),
scale: [
{value: .1, easing: 'easeOutSine', duration: 100},
{value: 1, easing: 'easeInOutQuad', duration: 100}
],
delay: anime.stagger(100, {grid: [rows, columns], from: 'center'})
};
//make the grid ripple from left (NOT YET FIXED)
var rippleEdge = {
targets: '.dots-layout .dot',
backgroundColor: '#FFF',
opacity: [
{value: 0, easing: 'easeOutSine', duration: 500},
{value: 0.8, easing: 'easeInOutQuad', duration: 500},
{value: 0, easing: 'easeOutSine', duration: 500}
],
delay: anime.stagger(30, {grid: [rows, columns], from: (rows * (columns/2))})
};
var textPopUp = {
targets: '.widget',
scale: [
{value: 1, easing: 'easeOutSine', duration: 100},
{value: 1.1, easing: 'easeInOutQuad', duration: 200},
{value: 1, easing: 'easeInOutQuad', duration: 200}
],
opacity: [
{value: 1, easing: 'easeInOutQuad', duration: 50}
]
};
var gridFade = {
targets: '.dots-layout .dot',
opacity: [
{value: 1},
{value: 0, easing: 'easeInOutQuad', duration: 300}
]
};
//Animation TIMELINES
const timeline = anime.timeline({
autoplay: false,
loop: 'false'
})
const hiAnimation = anime.timeline({
autoplay: false
})
const textSelect = anime.timeline({
autoplay: false
})
timeline.add(textPopUp)
.add(gridFade);
timeline.play();
hiAnimation.add(rippleMiddle)
.add(gridFade);
textSelect.add(textPopUp);