Solution dazzafact Posted November 22, 2020 Solution Share Posted November 22, 2020 How can i pass variables from a Loop i expect to access Values param1,param2,param3,etc But it always gives the last key param13 for (i in $slideTextArr){ let y=i; slideAni.eventCallback("onStart", function(t){ console.log(t) // always last key "param13" }, ["param"+y]); } UPDATE Solution: for (i in $slideTextArr){ let y=i; slideAni.to(textMesh[i],{ onStart:function(t){ console.log(t) }, onStartParams: ["param"+y] }) } Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 23, 2020 Share Posted November 23, 2020 To add some explanation as to why your solution works compared to your original: eventCallback overwrites previous callbacks for the same event and you should have one eventCallback for each tween that you have. 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