-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading.js
79 lines (68 loc) · 2.25 KB
/
loading.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
import gsap from "gsap";
let load = (percentLoaded)=>{
let indicator=document.querySelector(".indicator");
let percent = document.querySelector(".percent h1");
percent.innerText =percentLoaded+'%'
indicator.style.transform=`translateX(${-100+ percentLoaded}%)`
if(percentLoaded===100){
setTimeout(() => {
animate()
}, 500);
}
let animate=()=>{
let ease = 'back(3).out';
let durationShort = 0.5;
let duratiionAvg = 1;
let durationLong = 2;
let durationVeryLong=2.5;
let tl = new gsap.timeline()
tl.to('.progress-bar',{
opacity:0,
duration:durationLong,
ease:ease,
},'fade Out')
tl.to('.percent h1',{
opacity:0,
duration:durationLong,
ease:ease,
},'fade Out')
tl.to('.box1',{
rotate:'90deg',
duration:duratiionAvg,
delay:-1,
ease:ease
})
tl.to('.box3',{
opacity:1,
duration:durationShort,
ease:ease
})
tl.to('.overlay .wrapper',{
// opacity:0,
rotate:'45deg',
scale:30,
// x:'100%',
duration :durationVeryLong + 0.5,
delay:0.5
},'color')
tl.to('.box1, .box2 , .box3',{
backgroundColor:'#00000000',
duration:durationVeryLong,
delay:0.5,
ease:ease,
onComplete:()=>{
}
},'color')
tl.to('.overlay',{
opacity:0,
delay:1,
duration:duratiionAvg,
ease:ease,
onComplete:()=>{
// document.querySelector(".container").style.display='block';
document.querySelector(".overlay").style.display="none";
}
},'color')
}
}
export {load};