Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ryanf

StaggerTo Index Value

Recommended Posts

What is the syntax to pass the index value of a StaggerTo tween to another function via OnUpdateParams?  

 

I've tried: 

 

onUpdateParams:[$(this).index]} 

onUpdateParams:[{self}.index]}

 

Neither of which are working.  

 

See pen for example.  

 

 

Thanks.  

See the Pen gmeNEp by rfenik (@rfenik) on CodePen

Link to comment
Share on other sites

Hi ryanf :)

 

Please try this:

var timeline = new TimelineMax({repeat:-1});
timeline.add(TweenMax.staggerTo($item, .5, {autoAlpha:1, repeat:1, yoyo:true, repeatDelay:2.5, onUpdate:dotColorChange, onUpdateParams:["{self}"]}, 3)) 

function dotColorChange(){ 
  $("#indexValue").text("index:  "+$item.index(this.target));
}

Happy tweening.

:)

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