load static method

Future<SpriteAnimation> load(
  1. String src,
  2. SpriteAnimationData data, {
  3. Images? images,
})

Takes a path of an image, a SpriteAnimationData and loads the sprite animation. When the images is omitted, the global Flame.images is used.

Implementation

static Future<SpriteAnimation> load(
  String src,
  SpriteAnimationData data, {
  Images? images,
}) async {
  final imagesCache = images ?? Flame.images;
  final image = await imagesCache.load(src);
  return SpriteAnimation.fromFrameData(image, data);
}