1+ /*!
2+ * TweenJS
3+ * Visit http://createjs.com/ for documentation, updates and examples.
4+ *
5+ * Copyright (c) 2010 gskinner.com, inc.
6+ *
7+ * Permission is hereby granted, free of charge, to any person
8+ * obtaining a copy of this software and associated documentation
9+ * files (the "Software"), to deal in the Software without
10+ * restriction, including without limitation the rights to use,
11+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
12+ * copies of the Software, and to permit persons to whom the
13+ * Software is furnished to do so, subject to the following
14+ * conditions:
15+ *
16+ * The above copyright notice and this permission notice shall be
17+ * included in all copies or substantial portions of the Software.
18+ *
19+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26+ * OTHER DEALINGS IN THE SOFTWARE.
27+ */
128
229
330//##############################################################################
@@ -1496,6 +1523,15 @@ this.createjs = this.createjs||{};
14961523 * @protected
14971524 */
14981525 this . _status = - 1 ;
1526+
1527+ /**
1528+ * Tick id compared to Tween._inTick when removing tweens from the tick list in a tick stack.
1529+ * @property _lastTick
1530+ * @type Number
1531+ * @default 0
1532+ * @protected
1533+ */
1534+ this . _lastTick = 0 ;
14991535
15001536 if ( props ) {
15011537 this . useTicks = ! ! props . useTicks ;
@@ -2885,11 +2921,11 @@ this.createjs = this.createjs||{};
28852921 *
28862922 * Most methods on Ease can be passed directly as easing functions:
28872923 *
2888- * Tween.get(target).to({x:100}, 500, Ease.linear);
2924+ * createjs. Tween.get(target).to({x:100}, 500, createjs. Ease.linear);
28892925 *
28902926 * However, methods beginning with "get" will return an easing function based on parameter values:
28912927 *
2892- * Tween.get(target).to({y:200}, 500, Ease.getPowIn(2.2));
2928+ * createjs. Tween.get(target).to({y:200}, 500, createjs. Ease.getPowIn(2.2));
28932929 *
28942930 * Please see the <a href="http://www.createjs.com/Demos/TweenJS/Tween_SparkTable">spark table demo</a> for an
28952931 * overview of the different ease types on <a href="http://tweenjs.com">TweenJS.com</a>.
@@ -3801,6 +3837,213 @@ this.createjs = this.createjs||{};
38013837
38023838} ( ) ) ;
38033839
3840+ //##############################################################################
3841+ // TweenGroup.js
3842+ //##############################################################################
3843+
3844+ this . createjs = this . createjs || { } ;
3845+
3846+ ( function ( ) {
3847+ "use strict" ;
3848+
3849+ /**
3850+ * TweenGroup allows you to pause and time scale a collection of tweens or timelines. For example, this could be
3851+ * used to stop all tweens associated with a view when leaving that view.
3852+ *
3853+ * myView.tweens = new createjs.TweenGroup();
3854+ * myView.tweens.get(spinner, {loop: -1}).to({rotation:360}, 500);
3855+ * myView.tweens.get(image).to({alpha: 1}, 5000);
3856+ * // ... make all tweens in this view run in slow motion:
3857+ * myView.tweens.timeScale = 0.1;
3858+ * // ... pause all this view's active tweens:
3859+ * myView.tweens.paused = true; // stop all tweens.
3860+ *
3861+ * You can add a group to another group to nest it.
3862+ *
3863+ * viewTweenGroup.add(buttonTweenGroup);
3864+ *
3865+ * Tweens are automatically removed from the group when they complete (ie. when the `complete` event fires).
3866+ *
3867+ * @class TweenGroup
3868+ * @param {Boolean } [paused] The initial paused property value for this group.
3869+ * @param {Number } [timeScale] The intiial timeScale property value for this group.
3870+ * @constructor
3871+ **/
3872+ function TweenGroup ( paused , timeScale ) {
3873+ this . _tweens = [ ] ;
3874+ this . paused = paused ;
3875+ this . timeScale = timeScale ;
3876+ this . __onComplete = this . _onComplete . bind ( this ) ;
3877+ } ;
3878+ var s = TweenGroup , p = TweenGroup . prototype ;
3879+
3880+ // getter / setters:
3881+
3882+ /**
3883+ * @method _setPaused
3884+ * @param {Boolean } value
3885+ * @protected
3886+ **/
3887+ p . _setPaused = function ( value ) {
3888+ var tweens = this . _tweens ;
3889+ this . _paused = value = ! ! value ;
3890+ for ( var i = tweens . length - 1 ; i >= 0 ; i -- ) {
3891+ tweens [ i ] . paused = value ;
3892+ }
3893+ } ;
3894+
3895+ /**
3896+ * @method _getPaused
3897+ * @return {Boolean }
3898+ * @protected
3899+ **/
3900+ p . _getPaused = function ( ) {
3901+ return this . _paused ;
3902+ } ;
3903+
3904+ /**
3905+ * @method _setTimeScale
3906+ * @param {Number } value
3907+ * @protected
3908+ **/
3909+ p . _setTimeScale = function ( value ) {
3910+ var tweens = this . _tweens ;
3911+ this . _timeScale = value = value || null ;
3912+ for ( var i = tweens . length - 1 ; i >= 0 ; i -- ) {
3913+ tweens [ i ] . timeScale = value ;
3914+ }
3915+ } ;
3916+
3917+ /**
3918+ * @method _getTimeScale
3919+ * @return {Number }
3920+ * @protected
3921+ **/
3922+ p . _getTimeScale = function ( ) {
3923+ return this . _timeScale ;
3924+ } ;
3925+
3926+ /**
3927+ * Pauses or unpauses the group. The value is propagated to every tween or group that has been added to this group.
3928+ * @property paused
3929+ * @type Boolean
3930+ **/
3931+
3932+ /**
3933+ * Sets the time scale of the group. The value is propagated to every tween or group that has been added to this group.
3934+ * @property timeScale
3935+ * @type Number
3936+ **/
3937+ try {
3938+ Object . defineProperties ( p , {
3939+ paused : { set : p . _setPaused , get : p . _getPaused } ,
3940+ timeScale : { set : p . _setTimeScale , get : p . _getTimeScale }
3941+ } ) ;
3942+ } catch ( e ) { }
3943+
3944+ // public methods:
3945+ /**
3946+ * Shortcut method to create a new tween instance via {{#crossLink "Tween/get"}}{{/crossLink}} and immediately add it to this group.
3947+ * @method get
3948+ * @param {Object } target The target object that will have its properties tweened.
3949+ * @param {Object } [props] The configuration properties to apply to this instance. See {{#crossLink "Tween/get"}}{{/crossLink}} for more information.
3950+ * @return {Tween } A reference to the created tween.
3951+ **/
3952+ p . get = function ( target , props ) {
3953+ return this . add ( createjs . Tween . get ( target , props ) ) ;
3954+ }
3955+
3956+ /**
3957+ * Adds a Tween, Timeline, or TweenGroup instance to this group. The added object will immediately have its `paused` and `timeScale` properties
3958+ * set to the value of this group's corresponding properties.
3959+ *
3960+ * myGroup.paused = true;
3961+ * myGroup.add(myTween); // myTween is now paused
3962+ * // ...
3963+ * myGroup.paused = false; // myTween is now unpaused
3964+ *
3965+ * You can also add multiple objects:
3966+ *
3967+ * myGroup.add(myTween, myTween2, myTimeline, myOtherGroup);
3968+ *
3969+ * @method add
3970+ * @param {Tween,Timeline,TweenGroup } tween The tween, timeline, or tween group to add.
3971+ * @return {Object } This tween that was added.
3972+ **/
3973+ p . add = function ( tween ) {
3974+ var l = arguments . length , tweens = this . _tweens ;
3975+ for ( var i = 0 , l = arguments . length ; i < l ; i ++ ) {
3976+ tween = arguments [ i ] ;
3977+ tween . paused = this . _paused ;
3978+ if ( this . _timeScale !== null ) { tween . timeScale = this . _timeScale ; }
3979+ tweens . push ( tween ) ;
3980+ tween . addEventListener && tween . addEventListener ( "complete" , this . __onComplete ) ;
3981+ }
3982+ return arguments [ l - 1 ] ;
3983+ }
3984+
3985+ /**
3986+ * Removes a Tween, Timeline, or TweenGroup instance from this group.
3987+ *
3988+ * myGroup.remove(myTween);
3989+ *
3990+ * You can also remove multiple objects:
3991+ *
3992+ * myGroup.remove(myTween, myTween2, myTimeline, myOtherGroup);
3993+ *
3994+ * Note that tweens and timelines are automatically removed when their `complete` event fires.
3995+ * @method remove
3996+ * @param {Tween,Timeline,TweenGroup } tween The tween, timeline, or tween group to remove.
3997+ **/
3998+ p . remove = function ( tween ) {
3999+ var l = arguments . length , tweens = this . _tweens ;
4000+ for ( var i = 0 ; i < l ; i ++ ) {
4001+ tween = arguments [ i ] ;
4002+ for ( var j = tweens . length - 1 ; j >= 0 ; j -- ) {
4003+ if ( tweens [ j ] === tween ) {
4004+ tweens . splice ( j , 1 ) ;
4005+ tween . removeEventListener && tween . removeEventListener ( "complete" , this . __onComplete ) ;
4006+ }
4007+ }
4008+ }
4009+ }
4010+
4011+ /**
4012+ * Pauses all child tweens/timelines/groups and removes them from this group. Child groups will also be reset.
4013+ * @method reset
4014+ * @param {Boolean } keepGroups If true, groups will not be removed, only reset.
4015+ * @return {TweenGroup } This instance (for chaining calls).
4016+ * @chainable
4017+ **/
4018+ p . reset = function ( keepGroups ) {
4019+ var tweens = this . _tweens ;
4020+ for ( var i = tweens . length - 1 ; i >= 0 ; i -- ) {
4021+ var tween = tweens [ i ] ;
4022+ if ( tween instanceof TweenGroup ) {
4023+ tween . reset ( ) ;
4024+ if ( keepGroups ) { continue ; }
4025+ }
4026+ tweens . splice ( i , 1 ) ;
4027+ tween . paused = true ;
4028+ tween . removeEventListener && tween . removeEventListener ( "complete" , this . __onComplete ) ;
4029+ }
4030+ return this ;
4031+ }
4032+
4033+ // private methods:
4034+
4035+ /**
4036+ * @method _onComplete
4037+ * @param {Object } evt
4038+ * @protected
4039+ **/
4040+ p . _onComplete = function ( evt ) {
4041+ this . remove ( evt . target ) ;
4042+ }
4043+
4044+ createjs . TweenGroup = s ;
4045+ } ( ) ) ;
4046+
38044047//##############################################################################
38054048// version.js
38064049//##############################################################################
@@ -3831,6 +4074,6 @@ this.createjs = this.createjs || {};
38314074 * @type String
38324075 * @static
38334076 **/
3834- s . buildDate = /*=date*/ "Wed, 07 Feb 2018 22:16:16 GMT" ; // injected by build process
4077+ s . buildDate = /*=date*/ "Sat, 21 Apr 2018 23:26:12 GMT" ; // injected by build process
38354078
38364079} ) ( ) ;
0 commit comments