-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathscript.js
84 lines (73 loc) · 1.86 KB
/
script.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
function show(){
gsap.registerPlugin(ScrollTrigger);
const locoScroll = new LocomotiveScroll({
el: document.querySelector("#main"),
smooth: true
});
locoScroll.on("scroll", ScrollTrigger.update);
ScrollTrigger.scrollerProxy("#main", {
scrollTop(value) {
return arguments.length ? locoScroll.scrollTo(value, 0, 0) : locoScroll.scroll.instance.scroll.y;
},
getBoundingClientRect() {
return {top: 0, left: 0, width: window.innerWidth, height: window.innerHeight};
},
pinType: document.querySelector("#main").style.transform ? "transform" : "fixed"
});
ScrollTrigger.addEventListener("refresh", () => locoScroll.update());
ScrollTrigger.refresh();}
show()
gsap.to("#bottle", {
rotate: -15,
scrollTrigger: {
trigger: "#bottle",
scroller: "#main",
start: "top 5%",
end: "top -416%",
scrub: true,
pin: true
}
})
gsap.to("#bottle", {
scale: 0.5,
scrollTrigger: {
trigger: "#page5 h1",
scroller: "#main",
start: "top 430%",
end: "top -430%",
scrub: true,
pin: true
}
})
let t1 = gsap.timeline()
t1.from("#main #page1_dog_image", {
opacity: 0,
duration: 1,
scale: 0.1,
})
t1.from("#bottle", {
opacity: 0,
duration: 1,
scale: 0.2,
})
t1.from("#nav_top>button", {
xPrecent:200,
})
gsap.from("#page2_part1>button",{
scrollTrigger: {
trigger: ("#page2_part1>button"),
scroller: ("#main"),
start: "top 70%",
},
xPrecent:-300,
duration:1,
})
gsap.from("#page6_part6>button",{
scrollTrigger: {
trigger: ("#page6_part2>button"),
scroller: ("#main"),
start: "top 70%",
},
xPrecent:600,
duration:1,
})