Jump to content
Search Community

From Scrollmagic to ScrollTrigger

lmschreiber test
Moderator Tag

Recommended Posts

Hi,

I am trying to replace Scrollmagic with ScrollTrigger, but the animation is not triggered.
The Scrollmagic Code is:
 

let cTimeLineMax = gsap.timeline().set(divHeroBg, {y: 0, opacity: 1}).to(divHeroBg, 1, {
                    y: -50,
                    opacity: .8,
                    ease: Quad.easeInOut
                });
                new ScrollMagic.Scene({
                    triggerElement: divHeroContentWrap2, duration: divHeroContentWrap1.height(), triggerHook: 1
                }).setTween(cTimeLineMax).addTo(ScrollMagicController);

I tried to replace it with the following ScrollTrigger code:

gsap.timeline({
        ScrollTrigger: {
          trigger: divHeroContentWrap2,
          start: "center center",
          end: this.iScreenHeight + "px",
          pinSpacing: false
        }
      }).set(divHeroBg, {y: 0, opacity: 1}).to(divHeroBg, 1, {
        y: -50,
        opacity: .8,
        ease: Quad.easeInOut
      });

Does anybody see the mistake?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...