0

I'm using SpriteWidget in Flutter. https://github.com/spritewidget/spritewidget

I'm loading images like this:

// Load multiple images
await images.load([
  'assets/image_0.png',
  'assets/image_1.png',
  'assets/image_2.png',
]);

// Access a loaded image from the ImageMap
var image0 = images['assets/image_0.png'];

I'm trying to figure out how to loop through these images so that they are like an animated gif. Show image_0 for half a second, then image_1 for half a second then image_2 for half a second and so on.

I understand that the usual and recommended way to do this is with a spritesheet, but I do not have a sprite sheet, only individual images.

  • Related question for anyone who finds this: https://stackoverflow.com/questions/53770912/flutter-spritewidget-how-to-use-sprite-sheet – user2740650 Jan 13 '23 at 01:11

1 Answers1

1

How about using Sequences? You can loop over an array of images based on time.

https://github.com/spritewidget/spritewidget#sequences

Garry Taylor
  • 940
  • 8
  • 19
  • Rather than sequences I ended up using just the simple update method. https://github.com/spritewidget/spritewidget#handle-update-events – user3192190 Jun 07 '22 at 00:42