Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
pauloco

Prevent reverse in Tweenmax.from or .staggerFrom

Recommended Posts

Hey folks,

 

either I´m blind or there is no answer yet to my question:

 

I would like animations only to happen once when scrolling in, but when scrolling out (backwards, so the trigger is active again) and then scroll in again I dont want the animation to reverse and run again.

 

So long story short: the animation should only be triggered once and then the animated elements should stay where they are forever indepently of scrolling back:)

 

I found only this http://greensock.com/forums/topic/7832-disable-reverse/ but it seems not to be up to date anymore. Is there a simple way to achieve this? Or do I have to remove the listener by hand, once the animation finished?

 

The snippet shows that the "false" parameter doesn´t help here (just in case here without false parameter:

See the Pen zrJVLQ by anon (@anon) on CodePen

)...

 

Thanks in advance for any possible help. Somehow I feel this should be very easy to achieve, but I didn´t manage to make it work..

 

Greetings,

Paul

See the Pen obPrMj by anon (@anon) on CodePen

Link to post
Share on other sites

Hi pauloco :),

 

Welcome to the forums.

 

This is really more of a ScrollMagic rather than a GreenSock question, but I can certainly answer it for you.

 

Just add reverse:false to your scene parameters like this:

new ScrollMagic.Scene({
    triggerElement: '#redBox',
    reverse:false
  })

The animation will then play when you scroll down, but stay put when you scroll up again.

 

Here's some more reading about it:

http://janpaepke.github.io/ScrollMagic/docs/ScrollMagic.Scene.html#constructor

 

Happy tweening.

:)

  • Like 4
  • Thanks 1
Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×