greensock-rails 1.16.1.0 → 1.17.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 266339413f3b2f290f31305f05706e4ca9b9bc8b
4
- data.tar.gz: b076b7b1437577c07f7d708f1b6996228d22cf96
3
+ metadata.gz: c6ce900d8559db2bf6666ee9848f0b7888d0d5b5
4
+ data.tar.gz: d8fe4d669f79a27f1306418a8437d09b4d5673b6
5
5
  SHA512:
6
- metadata.gz: 332c7ff986a3eb9253c5a233f76a2eed8a9535066807a1db2e9a15e386be3bd29465137bfc17339afd0e329f26aee7b9ad897660a8a26fd21160091f73d5a347
7
- data.tar.gz: 08aefec60fc0c4ad62189de436225202f8d7323f479e40aa2aa3b31a19427a1e5c148234dbba80f69baa2ed58acd4612fb361be01c6acac69363f0086f9d3b54
6
+ metadata.gz: 0008ad78eff39e58ca20428d22d0ae40e5c8e1fd88259c6e9988ef9224527b7f26040837dd7220f56d4df097dee30d87a8cc289ef3799a6a62ebc789018be4f5
7
+ data.tar.gz: f346a5153e59e637acdfcb0941797f87bbfce206d16f661392d59a61f47f5b6e631c41d05c38f5d2be97b4a4a35f657806ed2b6c15b52f8bb5b96bb751d269ac
@@ -1,5 +1,5 @@
1
1
  module Greensock
2
2
  module Rails
3
- VERSION = "1.16.1.0"
3
+ VERSION = "1.17.0.0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.16.1
3
- * DATE: 2015-03-13
2
+ * VERSION: 1.17.0
3
+ * DATE: 2015-05-27
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
@@ -73,7 +73,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
73
73
  sibling = sibling._next;
74
74
  }
75
75
  if (callback) {
76
- callback.apply(scope || tl, params || _blankArray);
76
+ callback.apply(scope || tl.vars.callbackScope || tl, params || _blankArray);
77
77
  }
78
78
  if (this._forcingPlayhead || !tl._paused) { //the callback could have called resume().
79
79
  tl.seek(time);
@@ -89,7 +89,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
89
89
  },
90
90
  p = TimelineLite.prototype = new SimpleTimeline();
91
91
 
92
- TimelineLite.version = "1.16.1";
92
+ TimelineLite.version = "1.17.0";
93
93
  p.constructor = TimelineLite;
94
94
  p.kill()._gc = p._forcingPlayhead = false;
95
95
 
@@ -130,7 +130,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
130
130
  };
131
131
 
132
132
  p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
133
- var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, onCompleteScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
133
+ var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
134
134
  i;
135
135
  if (typeof(targets) === "string") {
136
136
  targets = TweenLite.selector(targets) || targets;
@@ -439,7 +439,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
439
439
  }
440
440
 
441
441
  if (prevTime === 0) if (this.vars.onStart) if (this._time !== 0) if (!suppressEvents) {
442
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
442
+ this._callback("onStart");
443
443
  }
444
444
 
445
445
  if (this._time >= prevTime) {
@@ -478,7 +478,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
478
478
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
479
479
  _lazyRender();
480
480
  }
481
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
481
+ this._callback("onUpdate");
482
482
  }
483
483
 
484
484
  if (callback) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
@@ -492,7 +492,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
492
492
  this._active = false;
493
493
  }
494
494
  if (!suppressEvents && this.vars[callback]) {
495
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
495
+ this._callback(callback);
496
496
  }
497
497
  }
498
498
  };
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.16.1
3
- * DATE: 2015-03-13
2
+ * VERSION: 1.17.0
3
+ * DATE: 2015-05-27
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
@@ -25,7 +25,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
25
25
  this._dirty = true;
26
26
  },
27
27
  _tinyNum = 0.0000000001,
28
- _blankArray = [],
29
28
  TweenLiteInternals = TweenLite._internals,
30
29
  _lazyTweens = TweenLiteInternals.lazyTweens,
31
30
  _lazyRender = TweenLiteInternals.lazyRender,
@@ -34,7 +33,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
34
33
 
35
34
  p.constructor = TimelineMax;
36
35
  p.kill()._gc = false;
37
- TimelineMax.version = "1.16.1";
36
+ TimelineMax.version = "1.17.0";
38
37
 
39
38
  p.invalidate = function() {
40
39
  this._yoyo = (this.vars.yoyo === true);
@@ -86,7 +85,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
86
85
  t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale );
87
86
  }
88
87
  if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it.
89
- vars.onStart.apply(vars.onStartScope || t, vars.onStartParams || _blankArray);
88
+ t._callback("onStart");
90
89
  }
91
90
  };
92
91
  return t;
@@ -95,7 +94,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
95
94
  p.tweenFromTo = function(fromPosition, toPosition, vars) {
96
95
  vars = vars || {};
97
96
  fromPosition = this._parseTimeOrLabel(fromPosition);
98
- vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], onCompleteScope:this};
97
+ vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], callbackScope:this};
99
98
  vars.immediateRender = (vars.immediateRender !== false);
100
99
  var t = this.tweenTo(toPosition, vars);
101
100
  return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001);
@@ -234,7 +233,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
234
233
  this.render(prevTime, suppressEvents, (dur === 0));
235
234
  if (!suppressEvents) if (!this._gc) {
236
235
  if (this.vars.onRepeat) {
237
- this.vars.onRepeat.apply(this.vars.onRepeatScope || this, this.vars.onRepeatParams || _blankArray);
236
+ this._callback("onRepeat");
238
237
  }
239
238
  }
240
239
  if (wrap) {
@@ -253,7 +252,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
253
252
 
254
253
  if ((this._time === prevTime || !this._first) && !force && !internalForce) {
255
254
  if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
256
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
255
+ this._callback("onUpdate");
257
256
  }
258
257
  return;
259
258
  } else if (!this._initted) {
@@ -265,7 +264,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
265
264
  }
266
265
 
267
266
  if (prevTotalTime === 0) if (this.vars.onStart) if (this._totalTime !== 0) if (!suppressEvents) {
268
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
267
+ this._callback("onStart");
269
268
  }
270
269
 
271
270
  if (this._time >= prevTime) {
@@ -305,7 +304,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
305
304
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
306
305
  _lazyRender();
307
306
  }
308
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
307
+ this._callback("onUpdate");
309
308
  }
310
309
  if (callback) if (!this._locked) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
311
310
  if (isComplete) {
@@ -318,7 +317,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
318
317
  this._active = false;
319
318
  }
320
319
  if (!suppressEvents && this.vars[callback]) {
321
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
320
+ this._callback(callback);
322
321
  }
323
322
  }
324
323
  };
@@ -537,7 +536,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
537
536
  sibling = sibling._next;
538
537
  }
539
538
  if (callback) {
540
- callback.apply(scope || tl, params || _blankArray);
539
+ callback.apply(scope || tl.vars.callbackScope || tl, params || _blankArray);
541
540
  }
542
541
  if (this._forcingPlayhead || !tl._paused) { //the callback could have called resume().
543
542
  tl.seek(time);
@@ -553,7 +552,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
553
552
  },
554
553
  p = TimelineLite.prototype = new SimpleTimeline();
555
554
 
556
- TimelineLite.version = "1.16.1";
555
+ TimelineLite.version = "1.17.0";
557
556
  p.constructor = TimelineLite;
558
557
  p.kill()._gc = p._forcingPlayhead = false;
559
558
 
@@ -594,7 +593,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
594
593
  };
595
594
 
596
595
  p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
597
- var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, onCompleteScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
596
+ var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
598
597
  i;
599
598
  if (typeof(targets) === "string") {
600
599
  targets = TweenLite.selector(targets) || targets;
@@ -903,7 +902,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
903
902
  }
904
903
 
905
904
  if (prevTime === 0) if (this.vars.onStart) if (this._time !== 0) if (!suppressEvents) {
906
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
905
+ this._callback("onStart");
907
906
  }
908
907
 
909
908
  if (this._time >= prevTime) {
@@ -942,7 +941,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
942
941
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
943
942
  _lazyRender();
944
943
  }
945
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
944
+ this._callback("onUpdate");
946
945
  }
947
946
 
948
947
  if (callback) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
@@ -956,7 +955,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
956
955
  this._active = false;
957
956
  }
958
957
  if (!suppressEvents && this.vars[callback]) {
959
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
958
+ this._callback(callback);
960
959
  }
961
960
  }
962
961
  };
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.16.1
3
- * DATE: 2015-03-13
2
+ * VERSION: 1.17.0
3
+ * DATE: 2015-05-27
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
@@ -536,6 +536,11 @@
536
536
  return copy;
537
537
  };
538
538
 
539
+ p._callback = function(type) {
540
+ var v = this.vars;
541
+ v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray);
542
+ };
543
+
539
544
  //----Animation getters/setters --------------------------------------------------------
540
545
 
541
546
  p.eventCallback = function(type, callback, params, scope) {
@@ -912,7 +917,7 @@
912
917
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
913
918
  p._notifyPluginsOfEnabled = p._lazy = false;
914
919
 
915
- TweenLite.version = "1.16.1";
920
+ TweenLite.version = "1.17.0";
916
921
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
917
922
  TweenLite.defaultOverwrite = "auto";
918
923
  TweenLite.ticker = _ticker;
@@ -936,7 +941,7 @@
936
941
  _plugins = TweenLite._plugins = {},
937
942
  _tweenLookup = _internals.tweenLookup = {},
938
943
  _tweenLookupNum = 0,
939
- _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1},
944
+ _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1, callbackScope:1},
940
945
  _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
941
946
  _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
942
947
  _rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
@@ -1036,7 +1041,7 @@
1036
1041
  for (i = 0; i < l; i++) {
1037
1042
  if ((curTween = siblings[i]) !== tween) {
1038
1043
  if (!curTween._gc) {
1039
- if (_onOverwrite(curTween, tween) && curTween._enabled(false, false)) {
1044
+ if (curTween._kill(null, target, tween)) {
1040
1045
  changed = true;
1041
1046
  }
1042
1047
  }
@@ -1381,7 +1386,7 @@
1381
1386
  }
1382
1387
  }
1383
1388
  if (this.vars.onStart) if (this._time !== 0 || duration === 0) if (!suppressEvents) {
1384
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
1389
+ this._callback("onStart");
1385
1390
  }
1386
1391
  }
1387
1392
  pt = this._firstPT;
@@ -1399,7 +1404,7 @@
1399
1404
  this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
1400
1405
  }
1401
1406
  if (!suppressEvents) if (this._time !== prevTime || isComplete) {
1402
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
1407
+ this._callback("onUpdate");
1403
1408
  }
1404
1409
  }
1405
1410
  if (callback) if (!this._gc || force) { //check _gc because there's a chance that kill() could be called in an onUpdate
@@ -1413,7 +1418,7 @@
1413
1418
  this._active = false;
1414
1419
  }
1415
1420
  if (!suppressEvents && this.vars[callback]) {
1416
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
1421
+ this._callback(callback);
1417
1422
  }
1418
1423
  if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
1419
1424
  this._rawPrevTime = 0;
@@ -1430,11 +1435,12 @@
1430
1435
  return this._enabled(false, false);
1431
1436
  }
1432
1437
  target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target;
1433
- var i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed;
1438
+ var simultaneousOverwrite = (overwritingTween && this._time && overwritingTween._startTime === this._startTime && this._timeline === overwritingTween._timeline),
1439
+ i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed;
1434
1440
  if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
1435
1441
  i = target.length;
1436
1442
  while (--i > -1) {
1437
- if (this._kill(vars, target[i])) {
1443
+ if (this._kill(vars, target[i], overwritingTween)) {
1438
1444
  changed = true;
1439
1445
  }
1440
1446
  }
@@ -1468,13 +1474,21 @@
1468
1474
  killed.push(p);
1469
1475
  }
1470
1476
  }
1471
- if (!_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it).
1477
+ if ((killed || !vars) && !_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it).
1472
1478
  return false;
1473
1479
  }
1474
1480
  }
1475
1481
 
1476
1482
  for (p in killProps) {
1477
1483
  if ((pt = propLookup[p])) {
1484
+ if (simultaneousOverwrite) { //if another tween overwrites this one and they both start at exactly the same time, yet this tween has already rendered once (for example, at 0.001) because it's first in the queue, we should revert the values to where they were at 0 so that the starting values aren't contaminated on the overwriting tween.
1485
+ if (pt.f) {
1486
+ pt.t[pt.p](pt.s);
1487
+ } else {
1488
+ pt.t[pt.p] = pt.s;
1489
+ }
1490
+ changed = true;
1491
+ }
1478
1492
  if (pt.pg && pt.t._kill(killProps)) {
1479
1493
  changed = true; //some plugins need to be notified so they can perform cleanup tasks first
1480
1494
  }
@@ -1561,7 +1575,7 @@
1561
1575
  };
1562
1576
 
1563
1577
  TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) {
1564
- return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0});
1578
+ return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0});
1565
1579
  };
1566
1580
 
1567
1581
  TweenLite.set = function(target, vars) {
@@ -1634,7 +1648,7 @@
1634
1648
 
1635
1649
  p._addTween = function(target, prop, start, end, overwriteProp, round) {
1636
1650
  var c, pt;
1637
- if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
1651
+ if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - Number(start) : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
1638
1652
  this._firstPT = pt = {_next:this._firstPT, t:target, p:prop, s:start, c:c, f:(typeof(target[prop]) === "function"), n:overwriteProp || prop, r:round};
1639
1653
  if (pt._next) {
1640
1654
  pt._next._prev = pt;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.16.1
3
- * DATE: 2015-03-13
2
+ * VERSION: 1.17.0
3
+ * DATE: 2015-05-27
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
@@ -41,7 +41,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
41
41
  p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
42
42
  _blankArray = [];
43
43
 
44
- TweenMax.version = "1.16.1";
44
+ TweenMax.version = "1.17.0";
45
45
  p.constructor = TweenMax;
46
46
  p.kill()._gc = false;
47
47
  TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
@@ -225,7 +225,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
225
225
 
226
226
  if (prevTime === this._time && !force && prevCycle === this._cycle) {
227
227
  if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
228
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
228
+ this._callback("onUpdate");
229
229
  }
230
230
  return;
231
231
  } else if (!this._initted) {
@@ -268,7 +268,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
268
268
  }
269
269
  }
270
270
  if (this.vars.onStart) if (this._totalTime !== 0 || duration === 0) if (!suppressEvents) {
271
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
271
+ this._callback("onStart");
272
272
  }
273
273
  }
274
274
 
@@ -287,11 +287,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
287
287
  this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
288
288
  }
289
289
  if (!suppressEvents) if (this._totalTime !== prevTotalTime || isComplete) {
290
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
290
+ this._callback("onUpdate");
291
291
  }
292
292
  }
293
293
  if (this._cycle !== prevCycle) if (!suppressEvents) if (!this._gc) if (this.vars.onRepeat) {
294
- this.vars.onRepeat.apply(this.vars.onRepeatScope || this, this.vars.onRepeatParams || _blankArray);
294
+ this._callback("onRepeat");
295
295
  }
296
296
  if (callback) if (!this._gc || force) { //check gc because there's a chance that kill() could be called in an onUpdate
297
297
  if (time < 0 && this._startAt && !this._onUpdate && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
@@ -304,7 +304,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
304
304
  this._active = false;
305
305
  }
306
306
  if (!suppressEvents && this.vars[callback]) {
307
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
307
+ this._callback(callback);
308
308
  }
309
309
  if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
310
310
  this._rawPrevTime = 0;
@@ -338,7 +338,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
338
338
  if (vars.onComplete) {
339
339
  vars.onComplete.apply(vars.onCompleteScope || this, arguments);
340
340
  }
341
- onCompleteAll.apply(onCompleteAllScope || this, onCompleteAllParams || _blankArray);
341
+ onCompleteAll.apply(onCompleteAllScope || vars.callbackScope || this, onCompleteAllParams || _blankArray);
342
342
  },
343
343
  l, copy, i, p;
344
344
  if (!_isArray(targets)) {
@@ -384,7 +384,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
384
384
  };
385
385
 
386
386
  TweenMax.delayedCall = function(delay, callback, params, scope, useFrames) {
387
- return new TweenMax(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, useFrames:useFrames, overwrite:0});
387
+ return new TweenMax(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, useFrames:useFrames, overwrite:0});
388
388
  };
389
389
 
390
390
  TweenMax.set = function(target, vars) {
@@ -665,7 +665,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
665
665
  sibling = sibling._next;
666
666
  }
667
667
  if (callback) {
668
- callback.apply(scope || tl, params || _blankArray);
668
+ callback.apply(scope || tl.vars.callbackScope || tl, params || _blankArray);
669
669
  }
670
670
  if (this._forcingPlayhead || !tl._paused) { //the callback could have called resume().
671
671
  tl.seek(time);
@@ -681,7 +681,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
681
681
  },
682
682
  p = TimelineLite.prototype = new SimpleTimeline();
683
683
 
684
- TimelineLite.version = "1.16.1";
684
+ TimelineLite.version = "1.17.0";
685
685
  p.constructor = TimelineLite;
686
686
  p.kill()._gc = p._forcingPlayhead = false;
687
687
 
@@ -722,7 +722,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
722
722
  };
723
723
 
724
724
  p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
725
- var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, onCompleteScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
725
+ var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
726
726
  i;
727
727
  if (typeof(targets) === "string") {
728
728
  targets = TweenLite.selector(targets) || targets;
@@ -1031,7 +1031,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1031
1031
  }
1032
1032
 
1033
1033
  if (prevTime === 0) if (this.vars.onStart) if (this._time !== 0) if (!suppressEvents) {
1034
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
1034
+ this._callback("onStart");
1035
1035
  }
1036
1036
 
1037
1037
  if (this._time >= prevTime) {
@@ -1070,7 +1070,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1070
1070
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
1071
1071
  _lazyRender();
1072
1072
  }
1073
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
1073
+ this._callback("onUpdate");
1074
1074
  }
1075
1075
 
1076
1076
  if (callback) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
@@ -1084,7 +1084,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1084
1084
  this._active = false;
1085
1085
  }
1086
1086
  if (!suppressEvents && this.vars[callback]) {
1087
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
1087
+ this._callback(callback);
1088
1088
  }
1089
1089
  }
1090
1090
  };
@@ -1351,7 +1351,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1351
1351
  this._dirty = true;
1352
1352
  },
1353
1353
  _tinyNum = 0.0000000001,
1354
- _blankArray = [],
1355
1354
  TweenLiteInternals = TweenLite._internals,
1356
1355
  _lazyTweens = TweenLiteInternals.lazyTweens,
1357
1356
  _lazyRender = TweenLiteInternals.lazyRender,
@@ -1360,7 +1359,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1360
1359
 
1361
1360
  p.constructor = TimelineMax;
1362
1361
  p.kill()._gc = false;
1363
- TimelineMax.version = "1.16.1";
1362
+ TimelineMax.version = "1.17.0";
1364
1363
 
1365
1364
  p.invalidate = function() {
1366
1365
  this._yoyo = (this.vars.yoyo === true);
@@ -1412,7 +1411,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1412
1411
  t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale );
1413
1412
  }
1414
1413
  if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it.
1415
- vars.onStart.apply(vars.onStartScope || t, vars.onStartParams || _blankArray);
1414
+ t._callback("onStart");
1416
1415
  }
1417
1416
  };
1418
1417
  return t;
@@ -1421,7 +1420,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1421
1420
  p.tweenFromTo = function(fromPosition, toPosition, vars) {
1422
1421
  vars = vars || {};
1423
1422
  fromPosition = this._parseTimeOrLabel(fromPosition);
1424
- vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], onCompleteScope:this};
1423
+ vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], callbackScope:this};
1425
1424
  vars.immediateRender = (vars.immediateRender !== false);
1426
1425
  var t = this.tweenTo(toPosition, vars);
1427
1426
  return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001);
@@ -1560,7 +1559,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1560
1559
  this.render(prevTime, suppressEvents, (dur === 0));
1561
1560
  if (!suppressEvents) if (!this._gc) {
1562
1561
  if (this.vars.onRepeat) {
1563
- this.vars.onRepeat.apply(this.vars.onRepeatScope || this, this.vars.onRepeatParams || _blankArray);
1562
+ this._callback("onRepeat");
1564
1563
  }
1565
1564
  }
1566
1565
  if (wrap) {
@@ -1579,7 +1578,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1579
1578
 
1580
1579
  if ((this._time === prevTime || !this._first) && !force && !internalForce) {
1581
1580
  if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
1582
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
1581
+ this._callback("onUpdate");
1583
1582
  }
1584
1583
  return;
1585
1584
  } else if (!this._initted) {
@@ -1591,7 +1590,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1591
1590
  }
1592
1591
 
1593
1592
  if (prevTotalTime === 0) if (this.vars.onStart) if (this._totalTime !== 0) if (!suppressEvents) {
1594
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
1593
+ this._callback("onStart");
1595
1594
  }
1596
1595
 
1597
1596
  if (this._time >= prevTime) {
@@ -1631,7 +1630,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1631
1630
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
1632
1631
  _lazyRender();
1633
1632
  }
1634
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
1633
+ this._callback("onUpdate");
1635
1634
  }
1636
1635
  if (callback) if (!this._locked) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
1637
1636
  if (isComplete) {
@@ -1644,7 +1643,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1644
1643
  this._active = false;
1645
1644
  }
1646
1645
  if (!suppressEvents && this.vars[callback]) {
1647
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
1646
+ this._callback(callback);
1648
1647
  }
1649
1648
  }
1650
1649
  };
@@ -2412,10 +2411,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
2412
2411
  p = CSSPlugin.prototype = new TweenPlugin("css");
2413
2412
 
2414
2413
  p.constructor = CSSPlugin;
2415
- CSSPlugin.version = "1.16.1";
2414
+ CSSPlugin.version = "1.17.0";
2416
2415
  CSSPlugin.API = 2;
2417
2416
  CSSPlugin.defaultTransformPerspective = 0;
2418
2417
  CSSPlugin.defaultSkewType = "compensated";
2418
+ CSSPlugin.defaultSmoothOrigin = true;
2419
2419
  p = "px"; //we'll reuse the "p" variable to keep file size down
2420
2420
  CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""};
2421
2421
 
@@ -3112,6 +3112,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3112
3112
  }
3113
3113
  },
3114
3114
 
3115
+ _addNonTweeningNumericPT = function(target, prop, start, end, next, overwriteProp) { //cleans up some code redundancies and helps minification. Just a fast way to add a NUMERIC non-tweening CSSPropTween
3116
+ var pt = new CSSPropTween(target, prop, start, end - start, next, -1, overwriteProp);
3117
+ pt.b = start;
3118
+ pt.e = pt.xs0 = end;
3119
+ return pt;
3120
+ },
3121
+
3115
3122
  /**
3116
3123
  * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example:
3117
3124
  * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt);
@@ -3441,7 +3448,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3441
3448
 
3442
3449
 
3443
3450
  //transform-related methods and properties
3444
- CSSPlugin.useSVGTransformAttr = _isSafari; //Safari has some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead.
3451
+ CSSPlugin.useSVGTransformAttr = _isSafari || _isFirefox; //Safari and Firefox both have some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead (users can override this).
3445
3452
  var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","),
3446
3453
  _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
3447
3454
  _transformPropCSS = _prefixCSS + "transform",
@@ -3481,18 +3488,94 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3481
3488
  }
3482
3489
  return force;
3483
3490
  })(),
3484
- _parseSVGOrigin = function(e, local, decoratee, absolute) {
3485
- var bbox, v;
3486
- if (!absolute || !(v = absolute.split(" ")).length) {
3487
- bbox = e.getBBox();
3491
+ _parseSVGOrigin = function(e, local, decoratee, absolute, smoothOrigin) {
3492
+ var tm = e._gsTransform,
3493
+ m = _getMatrix(e, true),
3494
+ v, x, y, xOrigin, yOrigin, a, b, c, d, tx, ty, determinant, xOriginOld, yOriginOld;
3495
+ if (tm) {
3496
+ xOriginOld = tm.xOrigin; //record the original values before we alter them.
3497
+ yOriginOld = tm.yOrigin;
3498
+ }
3499
+ if (!absolute || (v = absolute.split(" ")).length < 2) {
3500
+ b = e.getBBox();
3488
3501
  local = _parsePosition(local).split(" ");
3489
- v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * bbox.width : parseFloat(local[0])) + bbox.x,
3490
- (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * bbox.height : parseFloat(local[1])) + bbox.y];
3502
+ v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * b.width : parseFloat(local[0])) + b.x,
3503
+ (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * b.height : parseFloat(local[1])) + b.y];
3504
+ }
3505
+ decoratee.xOrigin = xOrigin = parseFloat(v[0]);
3506
+ decoratee.yOrigin = yOrigin = parseFloat(v[1]);
3507
+ if (absolute && m !== _identity2DMatrix) { //if svgOrigin is being set, we must invert the matrix and determine where the absolute point is, factoring in the current transforms. Otherwise, the svgOrigin would be based on the element's non-transformed position on the canvas.
3508
+ a = m[0];
3509
+ b = m[1];
3510
+ c = m[2];
3511
+ d = m[3];
3512
+ tx = m[4];
3513
+ ty = m[5];
3514
+ determinant = (a * d - b * c);
3515
+ x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + ((c * ty - d * tx) / determinant);
3516
+ y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - ((a * ty - b * tx) / determinant);
3517
+ xOrigin = decoratee.xOrigin = v[0] = x;
3518
+ yOrigin = decoratee.yOrigin = v[1] = y;
3519
+ }
3520
+ if (tm) { //avoid jump when transformOrigin is changed - adjust the x/y values accordingly
3521
+ if (smoothOrigin || (smoothOrigin !== false && CSSPlugin.defaultSmoothOrigin !== false)) {
3522
+ x = xOrigin - xOriginOld;
3523
+ y = yOrigin - yOriginOld;
3524
+ //originally, we simply adjusted the x and y values, but that would cause problems if, for example, you created a rotational tween part-way through an x/y tween. Managing the offset in a separate variable gives us ultimate flexibility.
3525
+ //tm.x -= x - (x * m[0] + y * m[2]);
3526
+ //tm.y -= y - (x * m[1] + y * m[3]);
3527
+ tm.xOffset += (x * m[0] + y * m[2]) - x;
3528
+ tm.yOffset += (x * m[1] + y * m[3]) - y;
3529
+ } else {
3530
+ tm.xOffset = tm.yOffset = 0;
3531
+ }
3491
3532
  }
3492
- decoratee.xOrigin = parseFloat(v[0]);
3493
- decoratee.yOrigin = parseFloat(v[1]);
3494
3533
  e.setAttribute("data-svg-origin", v.join(" "));
3495
3534
  },
3535
+ _isSVG = function(e) {
3536
+ return !!(_SVGElement && typeof(e.getBBox) === "function" && e.getCTM && (!e.parentNode || (e.parentNode.getBBox && e.parentNode.getCTM)));
3537
+ },
3538
+ _identity2DMatrix = [1,0,0,1,0,0],
3539
+ _getMatrix = function(e, force2D) {
3540
+ var tm = e._gsTransform || new Transform(),
3541
+ rnd = 100000,
3542
+ isDefault, s, m, n, dec;
3543
+ if (_transformProp) {
3544
+ s = _getStyle(e, _transformPropCSS, null, true);
3545
+ } else if (e.currentStyle) {
3546
+ //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix.
3547
+ s = e.currentStyle.filter.match(_ieGetMatrixExp);
3548
+ s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : "";
3549
+ }
3550
+ isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)");
3551
+ if (tm.svg || (e.getBBox && _isSVG(e))) {
3552
+ if (isDefault && (e.style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values
3553
+ s = e.style[_transformProp];
3554
+ isDefault = 0;
3555
+ }
3556
+ m = e.getAttribute("transform");
3557
+ if (isDefault && m) {
3558
+ if (m.indexOf("matrix") !== -1) { //just in case there's a "transform" value specified as an attribute instead of CSS style. Accept either a matrix() or simple translate() value though.
3559
+ s = m;
3560
+ isDefault = 0;
3561
+ } else if (m.indexOf("translate") !== -1) {
3562
+ s = "matrix(1,0,0,1," + m.match(/(?:\-|\b)[\d\-\.e]+\b/gi).join(",") + ")";
3563
+ isDefault = 0;
3564
+ }
3565
+ }
3566
+ }
3567
+ if (isDefault) {
3568
+ return _identity2DMatrix;
3569
+ }
3570
+ //split the matrix values out into an array (m for matrix)
3571
+ m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
3572
+ i = m.length;
3573
+ while (--i > -1) {
3574
+ n = Number(m[i]);
3575
+ m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example).
3576
+ }
3577
+ return (force2D && m.length > 6) ? [m[0], m[1], m[4], m[5], m[12], m[13]] : m;
3578
+ },
3496
3579
 
3497
3580
  /**
3498
3581
  * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10.
@@ -3512,37 +3595,16 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3512
3595
  rnd = 100000,
3513
3596
  zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0,
3514
3597
  defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0,
3515
- isDefault, s, m, i, n, dec, scaleX, scaleY, rotation, skewX;
3516
- if (_transformProp) {
3517
- s = _getStyle(t, _transformPropCSS, cs, true);
3518
- } else if (t.currentStyle) {
3519
- //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix.
3520
- s = t.currentStyle.filter.match(_ieGetMatrixExp);
3521
- s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : "";
3522
- }
3523
- isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)");
3524
- tm.svg = !!(_SVGElement && typeof(t.getBBox) === "function" && t.getCTM && (!t.parentNode || (t.parentNode.getBBox && t.parentNode.getCTM))); //don't just rely on "instanceof _SVGElement" because if the SVG is embedded via an object tag, it won't work (SVGElement is mapped to a different object)
3598
+ m, i, scaleX, scaleY, rotation, skewX;
3599
+
3600
+ tm.svg = !!(t.getBBox && _isSVG(t));
3525
3601
  if (tm.svg) {
3526
- if (isDefault && (t.style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values
3527
- s = t.style[_transformProp];
3528
- isDefault = false;
3529
- }
3530
3602
  _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, _cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin"));
3531
3603
  _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr;
3532
- m = t.getAttribute("transform");
3533
- if (isDefault && m && m.indexOf("matrix") !== -1) { //just in case there's a "transform" value specified as an attribute instead of CSS style. Only accept a matrix, though.
3534
- s = m;
3535
- isDefault = 0;
3536
- }
3537
3604
  }
3538
- if (!isDefault) {
3539
- //split the matrix values out into an array (m for matrix)
3540
- m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
3541
- i = m.length;
3542
- while (--i > -1) {
3543
- n = Number(m[i]);
3544
- m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example).
3545
- }
3605
+ m = _getMatrix(t);
3606
+ if (m !== _identity2DMatrix) {
3607
+
3546
3608
  if (m.length === 16) {
3547
3609
  //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values)
3548
3610
  var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
@@ -3655,8 +3717,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3655
3717
  tm.scaleZ = 1;
3656
3718
  }
3657
3719
  if (tm.svg) {
3658
- tm.x -= tm.xOrigin - (tm.xOrigin * a - tm.yOrigin * b);
3659
- tm.y -= tm.yOrigin - (tm.yOrigin * d - tm.xOrigin * c);
3720
+ tm.x -= tm.xOrigin - (tm.xOrigin * a + tm.yOrigin * c);
3721
+ tm.y -= tm.yOrigin - (tm.xOrigin * b + tm.yOrigin * d);
3660
3722
  }
3661
3723
  }
3662
3724
  tm.zOrigin = zOrigin;
@@ -3667,14 +3729,18 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3667
3729
  }
3668
3730
  }
3669
3731
  }
3670
- //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective);
3732
+ //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective+ ", origin: "+ tm.xOrigin+ ","+ tm.yOrigin);
3671
3733
  if (rec) {
3672
3734
  t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method)
3673
3735
  if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean.
3674
3736
  if (_useSVGTransformAttr && t.style[_transformProp]) {
3675
- _removeProp(t.style, _transformProp);
3737
+ TweenLite.delayedCall(0.001, function(){ //if we apply this right away (before anything has rendered), we risk there being no transforms for a brief moment and it also interferes with adjusting the transformOrigin in a tween with immediateRender:true (it'd try reading the matrix and it wouldn't have the appropriate data in place because we just removed it).
3738
+ _removeProp(t.style, _transformProp);
3739
+ });
3676
3740
  } else if (!_useSVGTransformAttr && t.getAttribute("transform")) {
3677
- t.removeAttribute("transform");
3741
+ TweenLite.delayedCall(0.001, function(){
3742
+ t.removeAttribute("transform");
3743
+ });
3678
3744
  }
3679
3745
  }
3680
3746
  }
@@ -3785,7 +3851,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3785
3851
  force3D = t.force3D,
3786
3852
  a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43,
3787
3853
  zOrigin, min, cos, sin, t1, t2, transform, comma, zero, skew, rnd;
3788
-
3789
3854
  //check to see if we should render as 2D (and SVGs must use 2D when _useSVGTransformAttr is true)
3790
3855
  if (((((v === 1 || v === 0) && force3D === "auto" && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) || !force3D) && !z && !perspective && !rotationY && !rotationX) || (_useSVGTransformAttr && isSVG) || !_supports3D) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween.
3791
3856
 
@@ -3809,8 +3874,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3809
3874
  }
3810
3875
  }
3811
3876
  if (isSVG) {
3812
- x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12);
3813
- y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22);
3877
+ x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset;
3878
+ y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset;
3879
+ if (_useSVGTransformAttr && (t.xPercent || t.yPercent)) { //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the matrix to simulate it.
3880
+ min = this.t.getBBox();
3881
+ x += t.xPercent * 0.01 * min.width;
3882
+ y += t.yPercent * 0.01 * min.height;
3883
+ }
3814
3884
  min = 0.000001;
3815
3885
  if (x < min) if (x > -min) {
3816
3886
  x = 0;
@@ -3954,8 +4024,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3954
4024
  z += a33*-zOrigin+zOrigin;
3955
4025
  }
3956
4026
  if (isSVG) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually
3957
- x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12);
3958
- y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22);
4027
+ x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset;
4028
+ y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset;
3959
4029
  }
3960
4030
  if (x < min && x > -min) {
3961
4031
  x = zero;
@@ -3984,19 +4054,21 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3984
4054
  };
3985
4055
 
3986
4056
  p = Transform.prototype;
3987
- p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = 0;
4057
+ p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = p.xOffset = p.yOffset = 0;
3988
4058
  p.scaleX = p.scaleY = p.scaleZ = 1;
3989
4059
 
3990
- _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent", {parser:function(t, e, p, cssp, pt, plugin, vars) {
4060
+ _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin", {parser:function(t, e, p, cssp, pt, plugin, vars) {
3991
4061
  if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it.
3992
4062
  cssp._lastParsedTransform = vars;
3993
- var m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform),
4063
+ var originalGSTransform = t._gsTransform,
4064
+ m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform),
3994
4065
  style = t.style,
3995
4066
  min = 0.000001,
3996
4067
  i = _transformProps.length,
3997
4068
  v = vars,
3998
4069
  endRotations = {},
3999
- m2, skewY, copy, orig, has3D, hasChange, dr;
4070
+ transformOriginString = "transformOrigin",
4071
+ m2, skewY, copy, orig, has3D, hasChange, dr, x, y;
4000
4072
  if (typeof(v.transform) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)"
4001
4073
  copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly.
4002
4074
  copy[_transformProp] = v.transform;
@@ -4005,6 +4077,12 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4005
4077
  _doc.body.appendChild(_tempDiv);
4006
4078
  m2 = _getTransform(_tempDiv, null, false);
4007
4079
  _doc.body.removeChild(_tempDiv);
4080
+ if (v.xPercent != null) {
4081
+ m2.xPercent = _parseVal(v.xPercent, m1.xPercent);
4082
+ }
4083
+ if (v.yPercent != null) {
4084
+ m2.yPercent = _parseVal(v.yPercent, m1.yPercent);
4085
+ }
4008
4086
  } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object)
4009
4087
  m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX),
4010
4088
  scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY),
@@ -4077,13 +4155,15 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4077
4155
 
4078
4156
  orig = v.transformOrigin;
4079
4157
  if (m1.svg && (orig || v.svgOrigin)) {
4080
- _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin);
4081
- pt = new CSSPropTween(m1, "xOrigin", m1.xOrigin, m2.xOrigin - m1.xOrigin, pt, -1, "transformOrigin");
4082
- pt.b = m1.xOrigin;
4083
- pt.e = pt.xs0 = m2.xOrigin;
4084
- pt = new CSSPropTween(m1, "yOrigin", m1.yOrigin, m2.yOrigin - m1.yOrigin, pt, -1, "transformOrigin");
4085
- pt.b = m1.yOrigin;
4086
- pt.e = pt.xs0 = m2.yOrigin;
4158
+ x = m1.xOffset; //when we change the origin, in order to prevent things from jumping we adjust the x/y so we must record those here so that we can create PropTweens for them and flip them at the same time as the origin
4159
+ y = m1.yOffset;
4160
+ _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin, v.smoothOrigin);
4161
+ pt = _addNonTweeningNumericPT(m1, "xOrigin", (originalGSTransform ? m1 : m2).xOrigin, m2.xOrigin, pt, transformOriginString); //note: if there wasn't a transformOrigin defined yet, just start with the destination one; it's wasteful otherwise, and it causes problems with fromTo() tweens. For example, TweenLite.to("#wheel", 3, {rotation:180, transformOrigin:"50% 50%", delay:1}); TweenLite.fromTo("#wheel", 3, {scale:0.5, transformOrigin:"50% 50%"}, {scale:1, delay:2}); would cause a jump when the from values revert at the beginning of the 2nd tween.
4162
+ pt = _addNonTweeningNumericPT(m1, "yOrigin", (originalGSTransform ? m1 : m2).yOrigin, m2.yOrigin, pt, transformOriginString);
4163
+ if (x !== m1.xOffset || y !== m1.yOffset) {
4164
+ pt = _addNonTweeningNumericPT(m1, "xOffset", (originalGSTransform ? x : m1.xOffset), m1.xOffset, pt, transformOriginString);
4165
+ pt = _addNonTweeningNumericPT(m1, "yOffset", (originalGSTransform ? y : m1.yOffset), m1.yOffset, pt, transformOriginString);
4166
+ }
4087
4167
  orig = _useSVGTransformAttr ? null : "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin
4088
4168
  }
4089
4169
  if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly).
@@ -4091,7 +4171,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4091
4171
  hasChange = true;
4092
4172
  p = _transformOriginProp;
4093
4173
  orig = (orig || _getStyle(t, p, _cs, false, "50% 50%")) + ""; //cast as string to avoid errors
4094
- pt = new CSSPropTween(style, p, 0, 0, pt, -1, "transformOrigin");
4174
+ pt = new CSSPropTween(style, p, 0, 0, pt, -1, transformOriginString);
4095
4175
  pt.b = style[p];
4096
4176
  pt.plugin = plugin;
4097
4177
  if (_supports3D) {
@@ -4641,7 +4721,21 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4641
4721
  if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) {
4642
4722
  while (pt) {
4643
4723
  if (pt.type !== 2) {
4644
- pt.t[pt.p] = pt.e;
4724
+ if (pt.r && pt.type !== -1) {
4725
+ val = Math.round(pt.s + pt.c);
4726
+ if (!pt.type) {
4727
+ pt.t[pt.p] = val + pt.xs0;
4728
+ } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)"
4729
+ i = pt.l;
4730
+ str = pt.xs0 + val + pt.xs1;
4731
+ for (i = 1; i < pt.l; i++) {
4732
+ str += pt["xn"+i] + pt["xs"+(i+1)];
4733
+ }
4734
+ pt.t[pt.p] = str;
4735
+ }
4736
+ } else {
4737
+ pt.t[pt.p] = pt.e;
4738
+ }
4645
4739
  } else {
4646
4740
  pt.setRatio(v);
4647
4741
  }
@@ -4957,44 +5051,64 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4957
5051
  * AttrPlugin
4958
5052
  * ----------------------------------------------------------------
4959
5053
  */
4960
- _gsScope._gsDefine.plugin({
4961
- propName: "attr",
4962
- API: 2,
4963
- version: "0.3.3",
4964
5054
 
4965
- //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
4966
- init: function(target, value, tween) {
4967
- var p, start, end;
4968
- if (typeof(target.setAttribute) !== "function") {
4969
- return false;
4970
- }
4971
- this._target = target;
4972
- this._proxy = {};
4973
- this._start = {}; // we record start and end values exactly as they are in case they're strings (not numbers) - we need to be able to revert to them cleanly.
4974
- this._end = {};
4975
- for (p in value) {
4976
- this._start[p] = this._proxy[p] = start = target.getAttribute(p);
4977
- end = this._addTween(this._proxy, p, parseFloat(start), value[p], p);
4978
- this._end[p] = end ? end.s + end.c : value[p];
4979
- this._overwriteProps.push(p);
4980
- }
4981
- return true;
4982
- },
5055
+ (function() {
5056
+ var _numExp = /(?:\d|\-|\+|=|#|\.)*/g,
5057
+ _suffixExp = /[A-Za-z%]/g;
5058
+
5059
+ _gsScope._gsDefine.plugin({
5060
+ propName: "attr",
5061
+ API: 2,
5062
+ version: "0.4.0",
5063
+
5064
+ //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
5065
+ init: function(target, value, tween) {
5066
+ var p, start, end, suffix, i;
5067
+ if (typeof(target.setAttribute) !== "function") {
5068
+ return false;
5069
+ }
5070
+ this._target = target;
5071
+ this._proxy = {};
5072
+ this._start = {}; // we record start and end values exactly as they are in case they're strings (not numbers) - we need to be able to revert to them cleanly.
5073
+ this._end = {};
5074
+ this._suffix = {};
5075
+ for (p in value) {
5076
+ this._start[p] = this._proxy[p] = start = target.getAttribute(p) + "";
5077
+ this._end[p] = end = value[p] + "";
5078
+ this._suffix[p] = suffix = _suffixExp.test(end) ? end.replace(_numExp, "") : _suffixExp.test(start) ? start.replace(_numExp, "") : "";
5079
+ if (suffix) {
5080
+ i = end.indexOf(suffix);
5081
+ if (i !== -1) {
5082
+ end = end.substr(0, i);
5083
+ }
5084
+ }
5085
+ if(!this._addTween(this._proxy, p, parseFloat(start), end, p)) {
5086
+ this._suffix[p] = ""; //not a valid tween - perhaps something like an <img src=""> attribute.
5087
+ }
5088
+ if (end.charAt(1) === "=") {
5089
+ this._end[p] = (this._firstPT.s + this._firstPT.c) + suffix;
5090
+ }
5091
+ this._overwriteProps.push(p);
5092
+ }
5093
+ return true;
5094
+ },
4983
5095
 
4984
- //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
4985
- set: function(ratio) {
4986
- this._super.setRatio.call(this, ratio);
4987
- var props = this._overwriteProps,
4988
- i = props.length,
4989
- lookup = (ratio === 1) ? this._end : ratio ? this._proxy : this._start,
4990
- p;
4991
- while (--i > -1) {
4992
- p = props[i];
4993
- this._target.setAttribute(p, lookup[p] + "");
5096
+ //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
5097
+ set: function(ratio) {
5098
+ this._super.setRatio.call(this, ratio);
5099
+ var props = this._overwriteProps,
5100
+ i = props.length,
5101
+ lookup = (ratio === 1) ? this._end : ratio ? this._proxy : this._start,
5102
+ useSuffix = (lookup === this._proxy),
5103
+ p;
5104
+ while (--i > -1) {
5105
+ p = props[i];
5106
+ this._target.setAttribute(p, lookup[p] + (useSuffix ? this._suffix[p] : ""));
5107
+ }
4994
5108
  }
4995
- }
4996
5109
 
4997
- });
5110
+ });
5111
+ }());
4998
5112
 
4999
5113
 
5000
5114
 
@@ -5964,6 +6078,11 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
5964
6078
  return copy;
5965
6079
  };
5966
6080
 
6081
+ p._callback = function(type) {
6082
+ var v = this.vars;
6083
+ v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray);
6084
+ };
6085
+
5967
6086
  //----Animation getters/setters --------------------------------------------------------
5968
6087
 
5969
6088
  p.eventCallback = function(type, callback, params, scope) {
@@ -6340,7 +6459,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6340
6459
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
6341
6460
  p._notifyPluginsOfEnabled = p._lazy = false;
6342
6461
 
6343
- TweenLite.version = "1.16.1";
6462
+ TweenLite.version = "1.17.0";
6344
6463
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
6345
6464
  TweenLite.defaultOverwrite = "auto";
6346
6465
  TweenLite.ticker = _ticker;
@@ -6364,7 +6483,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6364
6483
  _plugins = TweenLite._plugins = {},
6365
6484
  _tweenLookup = _internals.tweenLookup = {},
6366
6485
  _tweenLookupNum = 0,
6367
- _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1},
6486
+ _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1, callbackScope:1},
6368
6487
  _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
6369
6488
  _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
6370
6489
  _rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
@@ -6464,7 +6583,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6464
6583
  for (i = 0; i < l; i++) {
6465
6584
  if ((curTween = siblings[i]) !== tween) {
6466
6585
  if (!curTween._gc) {
6467
- if (_onOverwrite(curTween, tween) && curTween._enabled(false, false)) {
6586
+ if (curTween._kill(null, target, tween)) {
6468
6587
  changed = true;
6469
6588
  }
6470
6589
  }
@@ -6809,7 +6928,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6809
6928
  }
6810
6929
  }
6811
6930
  if (this.vars.onStart) if (this._time !== 0 || duration === 0) if (!suppressEvents) {
6812
- this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
6931
+ this._callback("onStart");
6813
6932
  }
6814
6933
  }
6815
6934
  pt = this._firstPT;
@@ -6827,7 +6946,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6827
6946
  this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
6828
6947
  }
6829
6948
  if (!suppressEvents) if (this._time !== prevTime || isComplete) {
6830
- this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
6949
+ this._callback("onUpdate");
6831
6950
  }
6832
6951
  }
6833
6952
  if (callback) if (!this._gc || force) { //check _gc because there's a chance that kill() could be called in an onUpdate
@@ -6841,7 +6960,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6841
6960
  this._active = false;
6842
6961
  }
6843
6962
  if (!suppressEvents && this.vars[callback]) {
6844
- this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
6963
+ this._callback(callback);
6845
6964
  }
6846
6965
  if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
6847
6966
  this._rawPrevTime = 0;
@@ -6858,11 +6977,12 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6858
6977
  return this._enabled(false, false);
6859
6978
  }
6860
6979
  target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target;
6861
- var i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed;
6980
+ var simultaneousOverwrite = (overwritingTween && this._time && overwritingTween._startTime === this._startTime && this._timeline === overwritingTween._timeline),
6981
+ i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed;
6862
6982
  if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
6863
6983
  i = target.length;
6864
6984
  while (--i > -1) {
6865
- if (this._kill(vars, target[i])) {
6985
+ if (this._kill(vars, target[i], overwritingTween)) {
6866
6986
  changed = true;
6867
6987
  }
6868
6988
  }
@@ -6896,13 +7016,21 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6896
7016
  killed.push(p);
6897
7017
  }
6898
7018
  }
6899
- if (!_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it).
7019
+ if ((killed || !vars) && !_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it).
6900
7020
  return false;
6901
7021
  }
6902
7022
  }
6903
7023
 
6904
7024
  for (p in killProps) {
6905
7025
  if ((pt = propLookup[p])) {
7026
+ if (simultaneousOverwrite) { //if another tween overwrites this one and they both start at exactly the same time, yet this tween has already rendered once (for example, at 0.001) because it's first in the queue, we should revert the values to where they were at 0 so that the starting values aren't contaminated on the overwriting tween.
7027
+ if (pt.f) {
7028
+ pt.t[pt.p](pt.s);
7029
+ } else {
7030
+ pt.t[pt.p] = pt.s;
7031
+ }
7032
+ changed = true;
7033
+ }
6906
7034
  if (pt.pg && pt.t._kill(killProps)) {
6907
7035
  changed = true; //some plugins need to be notified so they can perform cleanup tasks first
6908
7036
  }
@@ -6989,7 +7117,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6989
7117
  };
6990
7118
 
6991
7119
  TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) {
6992
- return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0});
7120
+ return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0});
6993
7121
  };
6994
7122
 
6995
7123
  TweenLite.set = function(target, vars) {
@@ -7062,7 +7190,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
7062
7190
 
7063
7191
  p._addTween = function(target, prop, start, end, overwriteProp, round) {
7064
7192
  var c, pt;
7065
- if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
7193
+ if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - Number(start) : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
7066
7194
  this._firstPT = pt = {_next:this._firstPT, t:target, p:prop, s:start, c:c, f:(typeof(target[prop]) === "function"), n:overwriteProp || prop, r:round};
7067
7195
  if (pt._next) {
7068
7196
  pt._next._prev = pt;