Jump to content
GreenSock

Jim Tim

Why does onStart callBack is triggered for the first element passed in array.

Recommended Posts

Hello Team ,  Why does onStart callBack is triggered  for the first element passed in array.

tl.set([...chars], { opacity: 0 })
tl.to([...chars],{
  opacity: 1,
  ease: Linear.easeNone,
  willChange: "transform, opacity", immediateRender: false,
  onStart: placeHand,
  stagger:duration / chars.length,
  duration : (duration/chars.length)
});

in version 2 it gets called for every element that has been included in the array,

if  in v3 it triggers only for the first element then what will be the fix,
i want to call the onStart callback for every element in the array.

See the Pen abVmBzL by AniBhuvan (@AniBhuvan) on CodePen

Link to comment
Share on other sites

Hi Jim, 

 

You can place callbacks inside the stagger object, and they will be for each element.

 

tl.to(chars,{opacity: 1,
ease: Linear.easeNone,
willChange: "transform, opacity", immediateRender: false,
// onStart: placeHand,
stagger: {
  each: duration / chars.length,
  onStart: placeHand
},
duration : (duration/chars.length)
});

 

  • Like 1
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.
×