Skip to content

Commit b981f62

Browse files
committed
Added Play and StaggerPlay to the AnimationManager.
1 parent 24b223a commit b981f62

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

v3/src/animation/AnimationManager.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,52 @@ AnimationManager.prototype = {
128128
return child;
129129
},
130130

131+
play: function (key, child)
132+
{
133+
if (!Array.isArray(child))
134+
{
135+
child = [ child ];
136+
}
137+
138+
var anim = this.get(key);
139+
140+
if (!anim)
141+
{
142+
return;
143+
}
144+
145+
for (var i = 0; i < child.length; i++)
146+
{
147+
child[i].anims.play(key);
148+
}
149+
150+
return this;
151+
},
152+
153+
staggerPlay: function (key, child, stagger)
154+
{
155+
if (stagger === undefined) { stagger = 0; }
156+
157+
if (!Array.isArray(child))
158+
{
159+
child = [ child ];
160+
}
161+
162+
var anim = this.get(key);
163+
164+
if (!anim)
165+
{
166+
return;
167+
}
168+
169+
for (var i = 0; i < child.length; i++)
170+
{
171+
child[i].anims.delayedPlay(stagger * i, key);
172+
}
173+
174+
return this;
175+
},
176+
131177
generateFrameNumbers: function (key, config)
132178
{
133179
var startFrame = GetObjectValue(config, 'start', 0);

0 commit comments

Comments
 (0)