image sequence animator
a simple widget for animating a set of images with full custom controls as an alternative to using a gif file.
it is highly recommended to read the documentation and run the example project on a real device to fully understand and inspect the full range of capabilities.
this simple widget for animating a set of images (a.k.a an image sequence) with full custom controls as an alternative to using a gif file.
gif files are, as far as i know, not possible to control. with this package, you will have full control over your image sequence like controlling a video. you can loop, boomerang, change the color, play, pause, stop, skip, rewind, restart and more.
how-to-use
first, add your image sequence to your assets and update the “pubspec.yaml” accordingly.
then create an imagesequenceanimator widget as shown in the example:
imagesequenceanimator(
"assets/imagesequence", //foldername
"frame_", //filename
0, //suffixstart
5, //suffixcount
"png", //fileformat
60, //framecount
{key key,
fps : 60,
islooping : false,
isboomerang : false,
isautoplay : true,
color : colors.white,
onreadytoplay : _onreadytoplay,
onstartplaying : _onstartplaying,
onplaying : _onplaying,
onfinishplaying : _onfinishplaying})
void _onreadytoplay(imagesequenceanimatorstate _imagesequenceanimator);
void _onstartplaying(imagesequenceanimatorstate _imagesequenceanimator);
void _onplaying(imagesequenceanimatorstate _imagesequenceanimator);
void _onfinishplaying(imagesequenceanimatorstate _imagesequenceanimator);
further explanations:
for a complete set of descriptions for all parameters and methods, see the documentation.
- [islooping] will override [isboomerang] if both are set to true.
- all [imagesequenceprocesscallback] callbacks will return a reference to the created [imagesequenceanimator] state. you can save this instance for
further actions. - use [imagesequenceanimatorstate]’s
[void setislooping(bool islooping)], [void setisboomerang(bool isboomerang)], [void setcolor(color color)], [void play({double from: -1.0})],
[void rewind({double from: -1.0})], [void pause()], [void skip(double value, {double percentage: -1.0})], [void restart()], [void stop()]
methods for the corresponding actions. - use [imagesequenceanimatorstate]’s [double get currenttime] and [double get totaltime] methods to get the respective values.
Comments are closed.