Skip to content

Commit f254630

Browse files
committed
refacto: gsap3 syntax
1 parent 9b33caa commit f254630

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

099-parallax website/script.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
let controller = new ScrollMagic.Controller();
2-
let timeline = new TimelineMax();
1+
const controller = new ScrollMagic.Controller();
2+
const tl = gsap.timeline();
33

4-
timeline
5-
.to(".rock", 10, { y: -300 })
6-
.to(".girl", 10, { y: -200 }, "-=10")
7-
.fromTo(".background", { y: -50 }, { y: 0, duration: 10 }, "-=10")
8-
.to(".content", 10, { top: "0%" }, "-=10")
9-
.fromTo(".content-images", { opacity: 0 }, { opacity: 1, duration: 3 })
10-
.fromTo(".text", { opacity: 0 }, { opacity: 1, duration: 3 });
4+
tl.to(".rock", { duration: 10, y: -300 })
5+
.to(".girl", { duration: 10, y: -200 }, "-=10")
6+
.fromTo(".background", { y: -50 }, { duration: 10, y: 0 }, "-=10")
7+
.to(".content", { duration: 10, top: "0%" }, "-=10")
8+
.fromTo(".content-images", { opacity: 0 }, { duration: 3, opacity: 1 })
9+
.fromTo(".text", { opacity: 0 }, { duration: 3, opacity: 1 });
1110

1211
let scene = new ScrollMagic.Scene({
1312
triggerElement: "section",
1413
duration: "300%",
1514
triggerHook: 0,
1615
})
17-
.setTween(timeline)
16+
.setTween(tl)
1817
.setPin("section")
1918
.addTo(controller);

0 commit comments

Comments
 (0)