SpriteAnimation.variableSpriteList constructor
SpriteAnimation.variableSpriteList(})
Create animation from a list of sprites
each having its own duration
provided in the stepTimes
list.
Implementation
factory SpriteAnimation.variableSpriteList(
List<Sprite> sprites, {
required List<double> stepTimes,
bool loop = true,
}) {
assert(
stepTimes.length == sprites.length,
'Lengths of stepTimes and sprites lists must be equal',
);
return SpriteAnimation(
[
for (var i = 0; i < sprites.length; i++)
SpriteAnimationFrame(sprites[i], stepTimes[i]),
],
loop: loop,
);
}