Jump to content
Search Community

StaggerTo Index Value

ryanf test
Moderator Tag

Go to solution Solved by PointC,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

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

  • Solution

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