From 53fe0a9af80e149b47398c016cb58218cf377f28 Mon Sep 17 00:00:00 2001 From: Jack Doyle Date: Mon, 21 Jul 2014 12:31:37 -0500 Subject: [PATCH] 12.1.5 - Fixed bug that could cause zero-duration tweens at the very beginning of a nested timeline not to return to their beginning values if the playhead of the parent timeline goes past the nested timeline's startTime, and then goes back to EXACTLY on top of the startTime, and then before it. - Improved GC, protecting against a very particular scenario where a user writes bad JS code that maintains a reference to a timeline. - Fixed issue that could cause TweenMax.killAll() to go to the end of a tween instead of its beginning when it's reversed and the "complete" parameter is true. - Changed LoaderMax so that it doesn't URL-encode underscores since Facebook uses them. --- bower.json | 2 +- src/com/greensock/TimelineLite.as | 26 +++++++++++++------- src/com/greensock/TimelineMax.as | 10 ++++---- src/com/greensock/TweenLite.as | 6 ++--- src/com/greensock/TweenMax.as | 8 +++--- src/com/greensock/core/SimpleTimeline.as | 6 ++--- src/com/greensock/loading/LoaderMax.as | 6 ++--- src/com/greensock/loading/core/LoaderItem.as | 8 +++--- 8 files changed, 41 insertions(+), 31 deletions(-) diff --git a/bower.json b/bower.json index 9d054ec..8c8c3ce 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "gsap", - "version": "12.1.4", + "version": "12.1.5", "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", diff --git a/src/com/greensock/TimelineLite.as b/src/com/greensock/TimelineLite.as index 4eb592d..78a85ed 100755 --- a/src/com/greensock/TimelineLite.as +++ b/src/com/greensock/TimelineLite.as @@ -1,6 +1,6 @@ /** - * VERSION: 12.1.4 - * DATE: 2014-03-21 + * VERSION: 12.1.5 + * DATE: 2014-07-19 * AS3 (AS2 version is also available) * UPDATES AND DOCS AT: http://www.greensock.com/timelinelite/ **/ @@ -303,7 +303,7 @@ tl.add(nested); **/ public class TimelineLite extends SimpleTimeline { /** @private **/ - public static const version:String = "12.1.4"; + public static const version:String = "12.1.5"; /** @private **/ protected var _labels:Object; @@ -1566,7 +1566,7 @@ myAnimation.seek("myLabel"); } if (time < 0) { _active = false; - if (_duration == 0) if (_rawPrevTime >= 0 && _first != null) { //zero-duration timelines are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. + if (_rawPrevTime >= 0 && _first != null) { //zero-duration timelines are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. internalForce = true; } _rawPrevTime = time; @@ -1708,15 +1708,23 @@ myAnimation.seek("myLabel"); * @return an Array of TweenLite and/or TweenMax instances */ public function getTweensOf(target:Object, nested:Boolean=true):Array { - var tweens:Array = TweenLite.getTweensOf(target), - i:int = tweens.length, - a:Array = [], - cnt:int = 0; + var disabled:Boolean = this._gc, + a:Array = [], + cnt:int = 0, + tweens:Array, i:int; + if (disabled) { + _enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here. + } + tweens = TweenLite.getTweensOf(target); + i = tweens.length; while (--i > -1) { - if (tweens[i].timeline == this || (nested && _contains(tweens[i]))) { + if (tweens[i].timeline === this || (nested && _contains(tweens[i]))) { a[cnt++] = tweens[i]; } } + if (disabled) { + _enabled(false, true); + } return a; } diff --git a/src/com/greensock/TimelineMax.as b/src/com/greensock/TimelineMax.as index a27cb75..88f0f99 100755 --- a/src/com/greensock/TimelineMax.as +++ b/src/com/greensock/TimelineMax.as @@ -1,6 +1,6 @@ /** - * VERSION: 12.1.4 - * DATE: 2014-03-21 + * VERSION: 12.1.5 + * DATE: 2014-07-19 * AS3 (AS2 version is also available) * UPDATES AND DOCS AT: http://www.greensock.com/timelinemax/ **/ @@ -388,7 +388,7 @@ tl.add(nested); **/ public class TimelineMax extends TimelineLite implements IEventDispatcher { /** @private **/ - public static const version:String = "12.1.4"; + public static const version:String = "12.1.5"; /** @private **/ protected static var _listenerLookup:Object = {onCompleteListener:TweenEvent.COMPLETE, onUpdateListener:TweenEvent.UPDATE, onStartListener:TweenEvent.START, onRepeatListener:TweenEvent.REPEAT, onReverseCompleteListener:TweenEvent.REVERSE_COMPLETE}; /** @private **/ @@ -734,7 +734,7 @@ tl.add(nested); */ public function tweenTo(position:*, vars:Object=null):TweenLite { vars = vars || {}; - var copy:Object = {ease:_easeNone, overwrite:2, useFrames:usesFrames(), immediateRender:false}; + var copy:Object = {ease:_easeNone, overwrite:(vars.delay ? 2 : 1), useFrames:usesFrames(), immediateRender:false}; for (var p:String in vars) { copy[p] = vars[p]; } @@ -858,7 +858,7 @@ tl.add( myTimeline.tweenFromTo("myLabel2", 0) ); } if (time < 0) { _active = false; - if (_duration == 0) if (_rawPrevTime >= 0 && _first) { //zero-duration timelines are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. + if (_rawPrevTime >= 0 && _first) { //zero-duration timelines are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. internalForce = true; } _rawPrevTime = time; diff --git a/src/com/greensock/TweenLite.as b/src/com/greensock/TweenLite.as index 06a4947..3704f33 100755 --- a/src/com/greensock/TweenLite.as +++ b/src/com/greensock/TweenLite.as @@ -1,6 +1,6 @@ /** - * VERSION: 12.1.4 - * DATE: 2014-03-19 + * VERSION: 12.1.5 + * DATE: 2014-07-19 * AS3 (AS2 version is also available) * UPDATES AND DOCS AT: http://www.greensock.com **/ @@ -304,7 +304,7 @@ package com.greensock { public class TweenLite extends Animation { /** @private **/ - public static const version:String = "12.1.4"; + public static const version:String = "12.1.5"; /** Provides An easy way to change the default easing equation. Choose from any of the GreenSock eases in the com.greensock.easing package. @default Power1.easeOut **/ public static var defaultEase:Ease = new Ease(null, null, 1, 1); diff --git a/src/com/greensock/TweenMax.as b/src/com/greensock/TweenMax.as index 4a5391d..29823b7 100755 --- a/src/com/greensock/TweenMax.as +++ b/src/com/greensock/TweenMax.as @@ -1,6 +1,6 @@ /** - * VERSION: 12.1.4 - * DATE: 2014-03-19 + * VERSION: 12.1.5 + * DATE: 2014-07-19 * AS3 (AS2 version is also available) * UPDATES AND DOCS AT: http://www.greensock.com **/ @@ -530,7 +530,7 @@ package com.greensock { */ public class TweenMax extends TweenLite implements IEventDispatcher { /** @private **/ - public static const version:String = "12.1.4"; + public static const version:String = "12.1.5"; TweenPlugin.activate([ @@ -1635,7 +1635,7 @@ TweenMax.killAll(false, false, true, false); tween = a[i]; if (allTrue || (tween is SimpleTimeline) || ((isDC = (TweenLite(tween).target == TweenLite(tween).vars.onComplete)) && delayedCalls) || (tweens && !isDC)) { if (complete) { - tween.totalTime(tween.totalDuration()); + tween.totalTime(tween._reversed ? 0 : tween.totalDuration()); } else { tween._enabled(false, false); } diff --git a/src/com/greensock/core/SimpleTimeline.as b/src/com/greensock/core/SimpleTimeline.as index 2cbebfa..a1e80e8 100755 --- a/src/com/greensock/core/SimpleTimeline.as +++ b/src/com/greensock/core/SimpleTimeline.as @@ -1,6 +1,6 @@ /** - * VERSION: 12.0.3 - * DATE: 2013-02-28 + * VERSION: 12.0.4 + * DATE: 2014-07-08 * AS3 (AS2 version is also available) * UPDATES AND DOCS AT: http://www.greensock.com **/ @@ -135,7 +135,6 @@ package com.greensock.core { if (!skipDisable) { tween._enabled(false, true); } - tween.timeline = null; if (tween._prev) { tween._prev._next = tween._next; @@ -147,6 +146,7 @@ package com.greensock.core { } else if (_last === tween) { _last = tween._prev; } + tween._next = tween._prev = tween.timeline = null; if (_timeline) { _uncache(true); diff --git a/src/com/greensock/loading/LoaderMax.as b/src/com/greensock/loading/LoaderMax.as index a70a8f6..534414f 100755 --- a/src/com/greensock/loading/LoaderMax.as +++ b/src/com/greensock/loading/LoaderMax.as @@ -1,6 +1,6 @@ /** - * VERSION: 1.938 - * DATE: 2013-07-16 + * VERSION: 1.939 + * DATE: 2014-06-26 * AS3 * UPDATES AND DOCS AT: http://www.greensock.com/loadermax/ **/ @@ -143,7 +143,7 @@ function errorHandler(event:LoaderEvent):void { */ public class LoaderMax extends LoaderCore { /** @private **/ - public static const version:Number = 1.938; + public static const version:Number = 1.939; /** The default value that will be used for the estimatedBytes on loaders that don't declare one in the vars parameter of the constructor. **/ public static var defaultEstimatedBytes:uint = 20000; /** Controls the default value of auditSize in LoaderMax instances (normally true). For most situations, the auditSize feature is very convenient for ensuring that the overall progress of LoaderMax instances is reported accurately, but when working with very large quantities of files that have no estimatedBytes defined, some developers prefer to turn auditSize off by default. Of course you can always override the default for individual LoaderMax instances by defining an auditSize value in the vars parameter of the constructor. **/ diff --git a/src/com/greensock/loading/core/LoaderItem.as b/src/com/greensock/loading/core/LoaderItem.as index 8e3f6c8..dc9f006 100755 --- a/src/com/greensock/loading/core/LoaderItem.as +++ b/src/com/greensock/loading/core/LoaderItem.as @@ -1,6 +1,6 @@ /** - * VERSION: 1.936 - * DATE: 2013-10-28 + * VERSION: 1.937 + * DATE: 2014-06-26 * AS3 * UPDATES AND DOCS AT: http://www.greensock.com/loadermax/ **/ @@ -29,6 +29,8 @@ package com.greensock.loading.core { public class LoaderItem extends LoaderCore { /** @private **/ protected static var _cacheID:Number = new Date().getTime(); + /** @private **/ + protected static var _underlineExp:RegExp = /%5f/gi; /** @private **/ protected var _url:String; @@ -92,7 +94,7 @@ package com.greensock.loading.core { pair = a[i].split("="); data[pair.shift()] = pair.join("="); } - request.data = data; + request.data = data.toString().replace(_underlineExp, "_"); } if (_isLocal && this.vars.allowMalformedURL != true && _request.data != null && _request.url.substr(0, 4) != "http") { _request.method = "POST"; //to avoid errors when loading local files with GET URL parameters