Jump to content
Search Community

Stop previous infinite tween after scrollTrigger hits

kinglycodes test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • 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: 

https://stackblitz.com/edit/gsap-stop-previous-tween-ghlqdk?file=pages%2Findex.js

 

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