mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
feat(flame): Add helper methods to create frame data on SpriteSheet (#2754)
Add two methods to SpriteSheet to create frame data for SpriteAnimation
This commit is contained in:
committed by
GitHub
parent
7313cd5352
commit
477221998a
@ -501,12 +501,12 @@ class ParticlesExample extends FlameGame {
|
||||
const rows = 8;
|
||||
const frames = columns * rows;
|
||||
final spriteImage = images.fromCache('boom.png');
|
||||
final spritesheet = SpriteSheet.fromColumnsAndRows(
|
||||
final spriteSheet = SpriteSheet.fromColumnsAndRows(
|
||||
image: spriteImage,
|
||||
columns: columns,
|
||||
rows: rows,
|
||||
);
|
||||
final sprites = List<Sprite>.generate(frames, spritesheet.getSpriteById);
|
||||
final sprites = List<Sprite>.generate(frames, spriteSheet.getSpriteById);
|
||||
return SpriteAnimation.spriteList(sprites, stepTime: 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user