Skip to content

Commit

Permalink
12.1.2
Browse files Browse the repository at this point in the history
- Fixed minor issue with TweenMax.updateTo() that could cause it not to reset the duration if the tween had completed or was killed.

- Fixed issue that could cause a zero-duration tween or callback not to fire if its parent timeline's playhead was moved directly on top of it more than once in the same "tick".

- Now the TimelineLite/Max stagger methods copy its smoothChildTiming property to the sub-timeline to avoid behavioral differences in parent/child. (This was only an issue if you specifically set the TimelineLite/Max's smoothChildTiming to true)

- Fixed a floating point rounding error that [in EXTREMELY rare situations] could cause zero-duration tweens at the very beginning of a timeline not to render properly when the playhead is returned to the very beginning after having played through.

- Fixed issue in the tweenTo() and tweenFromTo() methods of TimelineLite/Max that could cause a manual change to the duration of the resulting tween not to be honored.

- Fixed issue that could cause a zero-duration tween to be overwritten if it is positioned exactly at the start time of another tween of the same target.

- Fixed issue that could cause an onUpdate not to fire for a zero-duration tween.

- Fixed an issue in QuaternionPlugin that cast values to a Number incorrectly
  • Loading branch information
jackdoyle committed Jan 10, 2014
1 parent 7dd7e4a commit 24f3371
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 48 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gsap",
"version": "12.1.1",
"version": "12.1.2",
"description": "GreenSock Animation Platform (GSAP) is a suite of high-performance AS3 classes for scripted animation (also available in JavaScript and AS2), including TweenLite, TweenMax, TimelineLite, TimelineMax, various easing equations, and plugins for things like animating along Bezier paths, filters, etc. See http://www.greensock.com/ for details.",
"author": {
"name": "Jack Doyle",
Expand Down
10 changes: 5 additions & 5 deletions src/com/greensock/TimelineLite.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.1.0
* DATE: 2013-10-21
* VERSION: 12.1.2
* DATE: 2013-12-21
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com/timelinelite/
**/
Expand Down Expand Up @@ -303,7 +303,7 @@ tl.add(nested);
**/
public class TimelineLite extends SimpleTimeline {
/** @private **/
public static const version:String = "12.1.0";
public static const version:String = "12.1.2";

/** @private **/
protected var _labels:Object;
Expand Down Expand Up @@ -725,7 +725,7 @@ tl.staggerTo(myArray, 1, {x:100}, 0.25, "myLabel+=2"); //places 2 seconds after
* @see #staggerFromTo()
*/
public function staggerTo(targets:Array, duration:Number, vars:Object, stagger:Number, position:*="+=0", onCompleteAll:Function=null, onCompleteAllParams:Array=null):* {
var tl:TimelineLite = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams});
var tl:TimelineLite = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, smoothChildTiming:this.smoothChildTiming});
for (var i:int = 0; i < targets.length; i++) {
if (vars.startAt != null) {
vars.startAt = _copy(vars.startAt);
Expand Down Expand Up @@ -1556,7 +1556,7 @@ myAnimation.seek("myLabel");
}
}
_rawPrevTime = (_duration !== 0 || !suppressEvents || time !== 0) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
time = totalDur + 0.000001; //to avoid occasional floating point rounding errors in Flash - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when Flash performed _time - tween._startTime, floating point errors would return a value that was SLIGHTLY off)
time = totalDur + 0.0001; //to avoid occasional floating point rounding errors in Flash - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when Flash performed _time - tween._startTime, floating point errors would return a value that was SLIGHTLY off)

} else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
_totalTime = _time = 0;
Expand Down
17 changes: 9 additions & 8 deletions src/com/greensock/TimelineMax.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.1.0
* DATE: 2013-10-21
* VERSION: 12.1.2
* DATE: 2013-12-21
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com/timelinemax/
**/
Expand Down Expand Up @@ -388,7 +388,7 @@ tl.add(nested);
**/
public class TimelineMax extends TimelineLite implements IEventDispatcher {
/** @private **/
public static const version:String = "12.1.0";
public static const version:String = "12.1.2";
/** @private **/
protected static var _listenerLookup:Object = {onCompleteListener:TweenEvent.COMPLETE, onUpdateListener:TweenEvent.UPDATE, onStartListener:TweenEvent.START, onRepeatListener:TweenEvent.REPEAT, onReverseCompleteListener:TweenEvent.REVERSE_COMPLETE};
/** @private **/
Expand Down Expand Up @@ -739,10 +739,11 @@ tl.add(nested);
copy[p] = vars[p];
}
copy.time = _parseTimeOrLabel(position);
var t:TweenLite = new TweenLite(this, (Math.abs(Number(copy.time) - _time) / _timeScale) || 0.001, copy);
var duration:Number = (Math.abs(Number(copy.time) - _time) / _timeScale) || 0.001;
var t:TweenLite = new TweenLite(this, duration, copy);
copy.onStart = function():void {
t.target.paused(true);
if (t.vars.time != t.target.time()) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all.
if (t.vars.time != t.target.time() && duration === t.duration()) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all.
t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale );
}
if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it.
Expand Down Expand Up @@ -843,7 +844,7 @@ tl.add( myTimeline.tweenFromTo("myLabel2", 0) );
_time = time = 0;
} else {
_time = _duration;
time = _duration + 0.000001; //to avoid occasional floating point rounding errors in Flash - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when Flash performed _time - tween._startTime, floating point errors would return a value that was SLIGHTLY off)
time = _duration + 0.0001; //to avoid occasional floating point rounding errors in Flash - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when Flash performed _time - tween._startTime, floating point errors would return a value that was SLIGHTLY off)
}

} else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
Expand Down Expand Up @@ -888,7 +889,7 @@ tl.add( myTimeline.tweenFromTo("myLabel2", 0) );
}
if (_time > _duration) {
_time = _duration;
time = _duration + 0.000001; //to avoid occasional floating point rounding errors in Flash - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when Flash performed _time - tween._startTime, floating point errors would return a value that was SLIGHTLY off)
time = _duration + 0.0001; //to avoid occasional floating point rounding errors in Flash - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when Flash performed _time - tween._startTime, floating point errors would return a value that was SLIGHTLY off)
} else if (_time < 0) {
_time = time = 0;
} else {
Expand Down Expand Up @@ -936,7 +937,7 @@ tl.add( myTimeline.tweenFromTo("myLabel2", 0) );
}
}
if (wrap) {
prevTime = (backwards) ? _duration + 0.000001 : -0.000001;
prevTime = (backwards) ? _duration + 0.0001 : -0.0001;
render(prevTime, true, false);
}
_locked = false;
Expand Down
10 changes: 5 additions & 5 deletions src/com/greensock/TweenLite.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.1.1
* DATE: 2013-10-29
* VERSION: 12.1.2
* DATE: 2013-12-21
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com
**/
Expand Down Expand Up @@ -304,7 +304,7 @@ package com.greensock {
public class TweenLite extends Animation {

/** @private **/
public static const version:String = "12.1.1";
public static const version:String = "12.1.2";

/** Provides An easy way to change the default easing equation. Choose from any of the GreenSock eases in the <code>com.greensock.easing</code> package. @default Power1.easeOut **/
public static var defaultEase:Ease = new Ease(null, null, 1, 1);
Expand Down Expand Up @@ -739,7 +739,7 @@ package com.greensock {
if (time < 0 && _startAt != null && _startTime != 0) { //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.
_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.
}
if (!suppressEvents) {
if (!suppressEvents) if (_time !== prevTime || isComplete) {
_onUpdate.apply(null, vars.onUpdateParams);
}
}
Expand Down Expand Up @@ -1297,7 +1297,7 @@ var a2 = TweenLite.getTweensOf([myObject1, myObject2]); //finds 3 tweens
if (_checkOverlap(curTween, globalStart, zeroDur) === 0) {
overlaps[oCount++] = curTween;
}
} else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale + 0.0000000001 > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= 0.0000000002)) {
} else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= 0.0000000002)) {
overlaps[oCount++] = curTween;
}
}
Expand Down
15 changes: 9 additions & 6 deletions src/com/greensock/TweenMax.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.1.1
* DATE: 2013-10-29
* VERSION: 12.1.2
* DATE: 2013-12-21
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com
**/
Expand Down Expand Up @@ -530,7 +530,7 @@ package com.greensock {
*/
public class TweenMax extends TweenLite implements IEventDispatcher {
/** @private **/
public static const version:String = "12.1.1";
public static const version:String = "12.1.2";

TweenPlugin.activate([

Expand Down Expand Up @@ -806,8 +806,8 @@ tween.updateTo({x:300, y:0}, false);
* @return self (makes chaining easier)
**/
public function updateTo(vars:Object, resetDuration:Boolean=false):* {
var curRatio:Number = ratio;
if (resetDuration) if (timeline != null) if (_startTime < _timeline._time) {
var curRatio:Number = ratio;
if (resetDuration) if (_startTime < _timeline._time) {
_startTime = _timeline._time;
_uncache(false);
if (_gc) {
Expand All @@ -823,6 +823,9 @@ tween.updateTo({x:300, y:0}, false);
if (resetDuration) {
_initted = false;
} else {
if (_gc) {
_enabled(true, false);
}
if (_notifyPluginsOfEnabled) if (_firstPT != null) {
_onPluginEvent("_onDisable", this); //in case a plugin like MotionBlur must perform some cleanup tasks
}
Expand Down Expand Up @@ -1013,7 +1016,7 @@ tween.updateTo({x:300, y:0}, false);
if (time < 0 && _startAt != null && _startTime != 0) {
_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.
}
if (!suppressEvents) {
if (!suppressEvents) if (_totalTime !== prevTotalTime || isComplete) {
_onUpdate.apply(null, vars.onUpdateParams);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/com/greensock/core/Animation.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.1.0
* DATE: 2013-10-21
* VERSION: 12.1.1
* DATE: 2013-12-07
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com
**/
Expand Down Expand Up @@ -47,7 +47,7 @@ tl.add( animateOut(), 3);
*/
public class Animation {
/** @private **/
public static const version:String = "12.1.0";
public static const version:String = "12.1.1";

/**
* The object that dispatches a <code>"tick"</code> event each time the engine updates, making it easy for
Expand Down Expand Up @@ -1029,7 +1029,7 @@ myAnimation.reversed( !myAnimation.reversed() ); //toggles the orientation
}
if (value != _reversed) {
_reversed = value;
totalTime(_totalTime, true);
totalTime(((_timeline && !_timeline.smoothChildTiming) ? totalDuration() - _totalTime : _totalTime), true);
}
return this;
}
Expand Down
32 changes: 16 additions & 16 deletions src/com/greensock/plugins/ColorTransformPlugin.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.0
* DATE: 2013-10-11
* VERSION: 12.1.3
* DATE: 2013-12-12
* AS3
* UPDATES AND DOCS AT: http://www.greensock.com
**/
Expand Down Expand Up @@ -81,21 +81,21 @@ TweenLite.to(mc, 1, {colorTransform:{tint:0xFF0000, tintAmount:0.5}});
end[p] = value[p];
}
}

if (!isNaN(value.tintAmount)) {
var ratio:Number = value.tintAmount / (1 - ((end.redMultiplier + end.greenMultiplier + end.blueMultiplier) / 3));
end.redOffset *= ratio;
end.greenOffset *= ratio;
end.blueOffset *= ratio;
end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1 - value.tintAmount;
} else if (!isNaN(value.exposure)) {
end.redOffset = end.greenOffset = end.blueOffset = 255 * (value.exposure - 1);
end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1;
} else if (!isNaN(value.brightness)) {
end.redOffset = end.greenOffset = end.blueOffset = Math.max(0, (value.brightness - 1) * 255);
end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1 - Math.abs(value.brightness - 1);
if (!(value is ColorTransform)) {
if (!isNaN(value.tintAmount)) {
var ratio:Number = value.tintAmount / (1 - ((end.redMultiplier + end.greenMultiplier + end.blueMultiplier) / 3));
end.redOffset *= ratio;
end.greenOffset *= ratio;
end.blueOffset *= ratio;
end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1 - value.tintAmount;
} else if (!isNaN(value.exposure)) {
end.redOffset = end.greenOffset = end.blueOffset = 255 * (value.exposure - 1);
end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1;
} else if (!isNaN(value.brightness)) {
end.redOffset = end.greenOffset = end.blueOffset = Math.max(0, (value.brightness - 1) * 255);
end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1 - Math.abs(value.brightness - 1);
}
}

_init(start, end);
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/com/greensock/plugins/QuaternionsPlugin.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* VERSION: 12.0
* DATE: 2012-02-14
* VERSION: 12.0.1
* DATE: 2013-12-26
* AS3
* UPDATES AND DOCS AT: http://www.greensock.com
**/
Expand Down Expand Up @@ -64,7 +64,7 @@ TweenLite.to(myCamera3D, 2, {quaternions:{orientation:new Quaternion(1, 0.5, 0.2
public function _initQuaternion(end:Object, p:String):void {
var angle:Number, q1:Object, q2:Object, x1:Number, x2:Number, y1:Number, y2:Number, z1:Number, z2:Number, w1:Number, w2:Number, theta:Number;
var isFunc:Boolean = (_target[p] is Function);
q1 = (!isFunc) ? Number(_target[p]) : _target[ ((p.indexOf("set") || !("get" + p.substr(3) in _target)) ? p : "get" + p.substr(3)) ]();
q1 = (!isFunc) ? _target[p] : _target[ ((p.indexOf("set") || !("get" + p.substr(3) in _target)) ? p : "get" + p.substr(3)) ]();
q2 = end;
x1 = q1.x; x2 = q2.x;
y1 = q1.y; y2 = q2.y;
Expand Down

0 comments on commit 24f3371

Please sign in to comment.