IntouchGroup Posted November 18, 2019 Share Posted November 18, 2019 (edited) 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 November 18, 2019 by IntouchGroup better title 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 18, 2019 Share Posted November 18, 2019 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 More sharing options...
IntouchGroup Posted November 18, 2019 Author Share Posted November 18, 2019 I'm this close to switching the team over to 3, I need to write up a best practices document first. OK, I'll come up with plan B. Thanks. Link to comment Share on other sites More sharing options...
GreenSock Posted November 18, 2019 Share Posted November 18, 2019 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. 2 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 18, 2019 Share Posted November 18, 2019 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. 2 Link to comment Share on other sites More sharing options...
GreenSock Posted November 19, 2019 Share Posted November 19, 2019 Oh, and to get the effect you wanted, @IntouchGroup, you can just wrap it in an array, like: .call(updateText, [["hae","scroll","statement1"]]) 1 Link to comment Share on other sites More sharing options...
IntouchGroup Posted November 19, 2019 Author Share Posted November 19, 2019 duh. I feel stupid, I knew that! Thank you! I'm digging v3 VERY much. I need to set up a code pen with a question I have about v3 as soon as I get some free time, LOL. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now