flutter_sprite

Last updated:

0 purchases

flutter_sprite Image
flutter_sprite Images
Add to Cart

Description:

flutter sprite

flutter_sprite #
Usage #
Spritesheet #
Spritesheet can be loaded from the flutter assets. Make sure you put the spritesheet json spec and the images in the
assets directory.
Loading the sprite #
Use Sprite.load to load a sprite from the flutter assets.
Future<void> loadSprite() async {
Sprite sprite = await Sprite.load('asset/swords_man/sprite.json');
}
copied to clipboard
Displaying and animating the sprite #
Widget build(BuildContext context) async {
return SpriteWidget(sprite);
}
copied to clipboard
Control the animation #
The sprite playback can be paused and restarted at any time using SpriteController. SpriteController is obtained
using onReady callback.
Widget build(BuildContext context) async {
return SpriteWidget(sprite, onReady: (controller) {
Timer(Duration(seconds: 10), () {
controller.pause();

Timer(Duration(seconds: 10), () {
controller.play();
});
});
});
}
copied to clipboard
TODO #

❌ Play from specific point
❌ Animation controls to debug animations

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.