I'm trying to figure out how this ScrollMagic Demo works. Here is the code they I am using from the demo:
var controller = new ScrollMagic.Controller({globalSceneOptions: {triggerHook: "onEnter", duration: "200%"}});
// build scenes
new ScrollMagic.Scene({triggerElement: "#home"})
.setTween("#home > div", {y: "100%", ease: Linear.easeNone})
.addIndicators()
.addTo(controller);
new ScrollMagic.Scene({triggerElement: "#work"})
.setTween("#work", {y: "-80%", ease: Linear.easeNone})
.addIndicators()
.addTo(controller);
new ScrollMagic.Scene({triggerElement: "#about"})
.setTween("#about > div", {y: "200%", ease: Linear.easeNone})
.addIndicators()
.addTo(controller);
I was under the impression the ScrollMagic was using GSAP, but I am not very familiar with this .setTween()
method of ScrollMagic.
Here are some of the things I am not fully able to understand:
duration
: Currently, it is set to200%
. Is this the duration the animation will take to complete in terms of scrolling the page?.setTween()
: The first parameter is an html selector but when I use a class it seems to break it. The 2nd parameter is they
position. But is this parameter used to offset the content on load i.e. is the#work
section is set to offset by-80%
on load?
I have tried to look at the documentation to figure this stuff out but they seem to be using a different method here. I am just looking for a simple parallax effect.