Jump to content
Search Community

Callback for end of tween, before repeatDelay?

elegantseagulls test
Moderator Tag

Recommended Posts

Then create your own stagger.

 

gsap.utils.toArray("div").forEach((el, i) => {
  
  gsap.timeline({
    delay: i * 1,
    repeat: -1,
    repeatDelay: 3
  })
  .to(el, {
    duration: 3,
    x: 600,
    visibility: 'visible', 
    onComplete: () => console.log("COMPLETE")
  })  
})

 

  • Like 3
Link to comment
Share on other sites

Can also be done using the distribute util if you need more advanced staggering.

 

const delay = gsap.utils.distribute({
  each: 1
});

gsap.utils.toArray("div").forEach((el, i, divs) => {
    
  gsap.timeline({
    delay: delay(i, el, divs),
    repeat: -1,
    repeatDelay: 3
  })
  .to(el, {
    ease: "none",
    duration: 3,
    x: 600,
    visibility: 'visible', 
    onComplete: () => console.log("COMPLETE")
  })  
})

 

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