Jump to content
Search Community

onCompleteParams ripping array elements apart

vsiege test
Moderator Tag

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



The onCompleteParams isn't handling the Array correctly. Each character in the first index of the array is getting split into multiple indexes in the receiving function. I am using the latest version of the library.

Dresden = function () {
	var _that = this;

	this.launch = function (dialogWindow2Launch) {

		switch (dialogWindow2Launch) {
			case ENUM.DIALOG:

				var twn = TweenMax.to(_id('dialogWindowImg'),1,{ backgroundPosition:'-3200px 0px', ease: SteppedEase.config(10), paused: true});
				var arr = [1];
				TweenMax.to(_id('dialogWindow'),0.4,{ y:'200px', ease: Back.easeOut.config(1), onComplete:onLaunchComplete, onCompleteParams:['HELP'] });

	function onLaunchComplete(dialogWindow2Launch){
		console.log('onLaunchComplete=',dialogWindow2Launch[0], dialogWindow2Launch.length);// OUTPUT = onLaunchComplete= H 4
		switch (dialogWindow2Launch[0]) {
			case ENUM.DIALOG:
				console.log('dialogWindow2Launch=',dialogWindow2Launch, dialogWindow2Launch.length);
				//TweenMax.to(_id('dialogWindowImg'),1,{ backgroundPosition:'-3200px 0px', ease: SteppedEase.config(10)});
Link to comment
Share on other sites

Everything is working as designed from what I can tell:


var tween = TweenLite.to("#redBox", 0.5, {x:550, onComplete:complete, onCompleteParams:["bob", 40]})

function complete(name, age) {
  console.log(name, age)





You need to format the onCompleteParams as an Array so that multiple parameters can get into the receiving function.

I think you are expecting the only parameter that gets sent to the receiving function to be an Array.

Does that help?


If not, please provide a reduced test case.

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