@@ -65,9 +65,7 @@ var TweenBuilder = function (parent, config, defaults)
6565 }
6666 }
6767
68- var tween = new Tween ( parent , data ) ;
69-
70- tween . totalTargets = targets . length ;
68+ var tween = new Tween ( parent , data , targets ) ;
7169
7270 tween . offset = GetAdvancedValue ( config , 'offset' , null ) ;
7371 tween . completeDelay = GetAdvancedValue ( config , 'completeDelay' , 0 ) ;
@@ -77,10 +75,10 @@ var TweenBuilder = function (parent, config, defaults)
7775 tween . useFrames = GetBoolean ( config , 'useFrames' , false ) ;
7876
7977 // Set the Callbacks
80-
8178 var scope = GetValue ( config , 'callbackScope' , tween ) ;
8279
83- var tweenArray = [ tween ] ;
80+ // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params
81+ var tweenArray = [ tween , null ] ;
8482
8583 var callbacks = Tween . TYPES ;
8684
@@ -96,78 +94,10 @@ var TweenBuilder = function (parent, config, defaults)
9694 var callbackParams = GetValue ( config , type + 'Params' , [ ] ) ;
9795
9896 // The null is reset to be the Tween target
99- tween . setCallback ( type , callback , tweenArray . concat ( null , callbackParams ) , callbackScope ) ;
97+ tween . setCallback ( type , callback , tweenArray . concat ( callbackParams ) , callbackScope ) ;
10098 }
10199 }
102100
103- /*
104- var onStart = GetValue(config, 'onStart', false);
105-
106- // The Start of the Tween
107- if (onStart)
108- {
109- var onStartScope = GetValue(config, 'onStartScope', scope);
110- var onStartParams = GetValue(config, 'onStartParams', []);
111-
112- tween.setCallback('onStart', onStart, tweenArray.concat(onStartParams), onStartScope);
113- }
114-
115- var onUpdate = GetValue(config, 'onUpdate', false);
116-
117- // Every time the tween updates (regardless which TweenDatas are running)
118- if (onUpdate)
119- {
120- var onUpdateScope = GetValue(config, 'onUpdateScope', scope);
121- var onUpdateParams = GetValue(config, 'onUpdateParams', []);
122-
123- tween.setCallback('onUpdate', onUpdate, tweenArray.concat(onUpdateParams), onUpdateScope);
124- }
125-
126- var onRepeat = GetValue(config, 'onRepeat', false);
127-
128- // When a TweenData repeats
129- if (onRepeat)
130- {
131- var onRepeatScope = GetValue(config, 'onRepeatScope', scope);
132- var onRepeatParams = GetValue(config, 'onRepeatParams', []);
133-
134- tween.setCallback('onRepeat', onRepeat, tweenArray.concat(null, onRepeatParams), onRepeatScope);
135- }
136-
137- var onLoop = GetValue(config, 'onLoop', false);
138-
139- // Called when the whole Tween loops
140- if (onLoop)
141- {
142- var onLoopScope = GetValue(config, 'onLoopScope', scope);
143- var onLoopParams = GetValue(config, 'onLoopParams', []);
144-
145- tween.setCallback('onLoop', onLoop, tweenArray.concat(onLoopParams), onLoopScope);
146- }
147-
148- var onYoyo = GetValue(config, 'onYoyo', false);
149-
150- // Called when a TweenData yoyos
151- if (onYoyo)
152- {
153- var onYoyoScope = GetValue(config, 'onYoyoScope', scope);
154- var onYoyoParams = GetValue(config, 'onYoyoParams', []);
155-
156- tween.setCallback('onYoyo', onYoyo, tweenArray.concat(null, onYoyoParams), onYoyoScope);
157- }
158-
159- var onComplete = GetValue(config, 'onComplete', false);
160-
161- // Called when the Tween completes, after the completeDelay, etc.
162- if (onComplete)
163- {
164- var onCompleteScope = GetValue(config, 'onCompleteScope', scope);
165- var onCompleteParams = GetValue(config, 'onCompleteParams', []);
166-
167- tween.setCallback('onComplete', onComplete, tweenArray.concat(onCompleteParams), onCompleteScope);
168- }
169- */
170-
171101 return tween ;
172102} ;
173103
0 commit comments