getSpriteAnimation static method
Implementation
static ControlledUpdateAnimation getSpriteAnimation(
List<TileSprite> frames,
double stepTime,
) {
var key = '';
final spriteList = <Sprite>[];
for (final frame in frames) {
final sprite = MapAssetsManager.getSprite(
frame.path,
frame.position,
frame.size,
);
key += '${frame.path}${frame.position.x}${frame.position.y}';
spriteList.add(sprite);
}
if (spriteAnimationCache.containsKey(key)) {
return spriteAnimationCache[key]!;
}
return spriteAnimationCache[key] =
ControlledUpdateAnimation.fromSpriteAnimation(
SpriteAnimation.spriteList(
spriteList,
stepTime: stepTime,
),
);
}