-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGsapanimation.js
122 lines (105 loc) · 2.65 KB
/
Gsapanimation.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
const tl = gsap.timeline();
// Navbar ANimation
tl.from(".header_logo", {
x: -100,
delay: 0.2,
duration: .3,
scale: 2,
opacity: 0
});
tl.from(".header_links,.header_menu_list>.menu_item", {
xPercent: 150,
delay: 0.1,
duration: 0.3,
opacity: 0,
stagger: .2,
});
tl.from(".socialLink>ul>.socialLink_li", {
x: -100,
delay: 0.1,
duration: 0.3,
opacity: 0,
stagger: 0.3
});
// ABOUT ME CONTENT
gsap.to('.aboutMe_summary .translate_p', {
transform: 'translateX(-200%)',
fontWeight: 100,
scrollTrigger: {
trigger: '.aboutMe',
scroller: '.smooth-content',
start: "top 10%",
end: "top -150%",
scrub: 2,
pin: true,
},
});
// Text FILLING CONTENT
let text;
function runSplit() {
text = new SplitType('.text_filliing', { types: 'lines' });
const wordElements = document.querySelectorAll(".line");
wordElements.forEach(element => {
const div = document.createElement("div");
div.classList.add("line-mask");
element.appendChild(div);
});
}
runSplit();
window.addEventListener("resize", function () {
text.revert();
runSplit();
})
const wordElements = document.querySelectorAll(".line");
wordElements.forEach(function (element) {
let triggerElement = element;
let targetElement = element.querySelector(".line-mask");
let tl = gsap.timeline()
tl.to(targetElement, {
width: 0,
duration: 1,
stagger: .1,
scrollTrigger: {
trigger: triggerElement,
scroller: '.smooth-content',
scrub: 1,
start: "top center",
end: "bottom center",
},
});
});
// SKILL SECTION
const skillTl = gsap.timeline({
scrollTrigger: {
trigger: '.skills',
scroller: '.smooth-content',
start: "top 0%",
end: "top -100%",
scrub: 1,
pin: true,
yoyo: true
},
});
skillTl.from('.skill_icon-list', {
scale: 0,
delay: 0.3,
opacity: 0.5,
duration: 0.3,
stagger: 0.2
})
gsap.from('.list_1', {
xPercent: -50,
duration: 0.1,
opacity: 0,
scrollTrigger: {
trigger: '.project_list_container>ul',
scroller: '.smooth-content',
start: "top -10%",
end: "top -100%",
scrub: 1,
pin: true,
},
})
ScrollTrigger.addEventListener('refresh', () =>
locoScroll.update())
ScrollTrigger.refresh();