Jump to content
Search Community

Invoking function on scrolling

Stagnax test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi, I was looking for animation on scrolling and i came across this

 

So I played with it a little.

I used scrollmagic to pin the layout during the duratoin of the box animation.

So now i want to create similar animation timelines, with few changes.

How do i put an individual timeline into a function and call it on scroll.

 

Ive tried this syntax, but it doesnt seem to work :

jQuery('.Screen').each(function () {
    var currentScreen = this;
    new ScrollMagic.Scene({ triggerElement: currentScreen, duration: 2000, offset: iScreenSize_H })
        .on('start', function () {
            console.log(this.triggerElement().id);
        }).addTo(controller);
});

Thank you .

See the Pen xjNzdr?editors=1010 by stagnax (@stagnax) on CodePen

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...