-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.js
117 lines (103 loc) · 2.98 KB
/
app.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
gsap.registerPlugin(ScrollTrigger);
document.addEventListener('DOMContentLoaded', () => {
const sections = gsap.utils.toArray('section');
let scrollTween = gsap.to(sections, {
xPercent: -100 * (sections.length - 1),
ease: 'none',
scrollTrigger: {
trigger: '.wrapper',
pin: true,
scrub: 0.5,
snap: 1 / (sections.length - 1),
start: 'top top',
end: 3000,
}
})
gsap.to('.logo', {
fontSize: '2.5rem',
top: '4rem',
scrollTrigger: {
trigger: '.logo',
start: 'top top',
end: 1500,
scrub: 0.5,
}
})
gsap.to('.line', {
height: '10rem',
scrollTrigger: {
trigger: '.line',
scrub: 0.5,
start: 'center center',
end: 2000,
}
})
document.querySelectorAll('.character').forEach(el => {
gsap.to(el.querySelector('.caption'), {
x: 0,
y: 0,
scrollTrigger: {
containerAnimation: scrollTween,
trigger: el.querySelector('.caption'),
start: 'top bottom',
end: '+=1000',
scrub: 0.5,
}
})
gsap.to(el.querySelector('.quote'), {
y: 0,
ease: 'none',
scrollTrigger: {
containerAnimation: scrollTween,
trigger: el.querySelector('.quote'),
start: 'top bottom',
end: '+=20%',
scrub: 0.5,
}
})
gsap.to(el.querySelector('.nickname'), {
y: 0,
ease: 'none',
scrollTrigger: {
containerAnimation: scrollTween,
trigger: el.querySelector('.nickname'),
start: 'top bottom',
end: '+=10%',
scrub: 0.5,
}
})
gsap.to(el.querySelector('.block'), {
x: 0,
ease: 'none',
scrollTrigger: {
containerAnimation: scrollTween,
trigger: el.querySelector('.block'),
start: 'top bottom',
end: '+=' + window.innerWidth,
scrub: 0.5,
}
})
gsap.to(el.querySelector('img'), {
y: 0,
ease: 'none',
scrollTrigger: {
containerAnimation: scrollTween,
trigger: el.querySelector('img'),
start: 'top bottom',
end: '+=50%',
scrub: 0.5,
}
})
gsap.to(el.querySelector('.huge-text'), {
y: 0,
ease: 'none',
scrollTrigger: {
containerAnimation: scrollTween,
trigger: el.querySelector('.huge-text'),
start: 'top bottom',
end: '+=100%',
scrub: 0.5,
}
})
})
})