Jump to content
Search Community

Stop previous infinite tween after scrollTrigger hits

kinglycodes test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts


How can I stop an infinite previous tween, when the following tween with scrollTrigger is ended?


In the example the infinite previous tween starts again, after the scrollTrigger tween is ended.

You have to wait 2 seconds to see it.


I have created a stackblitz which shows the exact problem

Stackblitz Example

Link to comment
Share on other sites

  • Solution

I noticed a few mistakes:

  1. You're nesting an animation that has a ScrollTrigger INSIDE a timeline. That can't logically work because the playhead can't be controlled by both a parent timeline AND the scrollbar position (they could be going in completely different directions). Never nest ScrollTriggers inside animations that are inside other timelines. 
  2. You're creating conflicting tweens. The infinitely bouncing one is fighting for control of opacity of the same element that's also trying to fade it out. 

I think the simplest solution is to just wrap your bouncing element in a wrapper so you can control their opacities independently: 



I hope that helps. 

  • Like 3
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...