File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ Change Log
3939
4040Version 1.1.3 - in build
4141
42- *
42+ * New: Sprite.animations.getAnimation will return an animation instance which was added by name.
43+ * Updated: RequestAnimationFrame now retains the callbackID which is passed to cancelRequestAnimationFrame.
44+
4345
4446Version 1.1.2 - November 1st 2013
4547
Original file line number Diff line number Diff line change @@ -261,6 +261,27 @@ Phaser.AnimationManager.prototype = {
261261
262262 } ,
263263
264+ /**
265+ * Returns an animation that was previously added by name.
266+ *
267+ * @method Phaser.AnimationManager#getAnimation
268+ * @param {string } name - The name of the animation to be returned, e.g. "fire".
269+ * @return {Phaser.Animation|boolean } The Animation instance, if found, otherwise false.
270+ */
271+ getAnimation : function ( name ) {
272+
273+ if ( typeof name == 'string' )
274+ {
275+ if ( this . _anims [ name ] )
276+ {
277+ return this . _anims [ name ] ;
278+ }
279+ }
280+
281+ return false ;
282+
283+ } ,
284+
264285 /**
265286 * Refreshes the current frame data back to the parent Sprite and also resets the texture data.
266287 *
Original file line number Diff line number Diff line change @@ -50,6 +50,13 @@ Phaser.RequestAnimationFrame = function(game) {
5050 */
5151 this . _onLoop = null ;
5252
53+ /**
54+ * The callback ID used when calling cancel
55+ * @property _timeOutID
56+ * @private
57+ */
58+ this . _timeOutID = null ;
59+
5360} ;
5461
5562Phaser . RequestAnimationFrame . prototype = {
@@ -83,7 +90,7 @@ Phaser.RequestAnimationFrame.prototype = {
8390 return _this . updateRAF ( time ) ;
8491 } ;
8592
86- window . requestAnimationFrame ( this . _onLoop ) ;
93+ this . _timeOutID = window . requestAnimationFrame ( this . _onLoop ) ;
8794 }
8895
8996 } ,
@@ -97,7 +104,7 @@ Phaser.RequestAnimationFrame.prototype = {
97104
98105 this . game . update ( time ) ;
99106
100- window . requestAnimationFrame ( this . _onLoop ) ;
107+ this . _timeOutID = window . requestAnimationFrame ( this . _onLoop ) ;
101108
102109 } ,
103110
@@ -125,7 +132,7 @@ Phaser.RequestAnimationFrame.prototype = {
125132 }
126133 else
127134 {
128- window . cancelAnimationFrame ;
135+ window . cancelAnimationFrame ( this . _timeOutID ) ;
129136 }
130137
131138 this . isRunning = false ;
You can’t perform that action at this time.
0 commit comments