Jump to content
Search Community

How to disable element animation after callback

Poylar test
Moderator Tag

Recommended Posts

Simple

const oldtl = gsap.timeline()
oldtl.to(elem, {
  x: 10000,
  onComplete: () => {
    const tl = gsap.timeline({ repeat: -1 })
    tl.to(elem, {
      x: 100,
      opacity: 0
    })
  }
})

How remove x 10000 after complete?

Now after calling the callback and playing the animation there, I still get x 1000 every time at the beginning of the animation

See the Pen gOvgyON?editors=1010 by poylar (@poylar) on CodePen

Link to comment
Share on other sites

46 minutes ago, PointC said:

Вы спрашиваете то же самое, что и в другой вашей теме здесь?

 

Yes, these questions are similar, but in that topic I went a little in a different direction.
I just tested this and I can't figure out why my previous timeline is being called when the new timeline is repeated.

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