Jump to content
Search Community

v2 timeline call params

IntouchGroup test
Moderator Tag

Recommended Posts

Please run the code pen but look at the console output.  

This is gsap version 2.1.3

I'm using a timeline call and passing three parameters, but I'm getting the individual letters of the first item: 

> h

> a

> e

Shouldn't I be getting the three words? 

> hae

> scroll

> statement1

See the Pen NWWeJWE by cmbarsotti (@cmbarsotti) on CodePen

Edited by IntouchGroup
better title
  • Thanks 1
Link to comment
Share on other sites

Hey IntouchGroup, welcome. Thanks for bringing this to our attention.

 

I think you're right, though I very well could be wrong. What's interesting is that it has this same behavior all the way back to the oldest JS version of GSAP. 

 

In GSAP 3 the function doesn't even fire, even when a tween is added so that the timeline has a duration. Something to take a look at here @GreenSock.

Link to comment
Share on other sites

This is the correct behavior. The params array is filled with the parameters that get passed to the callback, so if you have 3 elements in the array, then the callback will receive 3 parameters. See what I mean? So you're looping through only the very first parameter which is a string. 

 

@ZachSaucier it seems to work in v3, but he had an extra scope parameter in the call() method, that's all. 

 

@IntouchGroup good luck with getting the team switched over to v3 - I think you're gonna dig it. Let us know if you have any other questions/concerns. 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

3 minutes ago, GreenSock said:

The params array is filled with the parameters that get passed to the callback, so if you have 3 elements in the array, then the callback will receive 3 parameters.

Ahh, I knew that. Silly me. Thanks for the help!

 

Just updated the v3 docs to make that a little more clear by example.

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