File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,50 @@ Phaser.TweenManager.prototype = {
6868 this . _add = [ ] ;
6969
7070 } ,
71+
72+ /**
73+ * Remove all tweens from a specific object, array of objects or group.
74+ * @method Phaser.TweenManager#removeFrom
75+ * @param {object|object[]|Phaser.Group } obj - The object you want to remove the tweens from.
76+ * @param {boolean } children - If passing a group, setting this to true will remove the tweens from all of its children instead of the group itself.
77+ */
78+ removeFrom : function ( obj , children ) {
79+
80+ var o , c , t , len ;
81+
82+ if ( Array . isArray ( obj ) )
83+ {
84+ for ( o = 0 , len = obj . length ; o < len ; o ++ )
85+ {
86+ this . removeFrom ( obj [ o ] ) ;
87+ }
88+ }
89+ else if ( obj . type === Phaser . GROUP && children )
90+ {
91+ for ( c = 0 , len = obj . children . length ; c < len ; c ++ )
92+ {
93+ this . removeFrom ( obj . children [ c ] ) ;
94+ }
95+ }
96+ else
97+ {
98+ for ( t = 0 , len = this . _tweens . length ; t < len ; t ++ )
99+ {
100+ if ( obj === this . _tweens [ t ] . _object )
101+ {
102+ this . remove ( this . _tweens [ t ] ) ;
103+ }
104+ }
105+ for ( t = 0 , len = this . _add . length ; t < len ; t ++ )
106+ {
107+ if ( obj === this . _add [ t ] . _object )
108+ {
109+ this . remove ( this . _add [ t ] ) ;
110+ }
111+ }
112+ }
113+
114+ } ,
71115
72116 /**
73117 * Add a new tween into the TweenManager.
You can’t perform that action at this time.
0 commit comments