touchgfx::AnimatedImage class
@class AnimatedImage AnimatedImage.hpp touchgfx/widgets/AnimatedImage.hpp A widget capable of basic animation using a range of bitmaps. The AnimatedImage is capable of running the animation from start to end or in reverse order, end to start. It is capable doing a single animation or looping the animation until stopped or paused. See animation_example far a demonstration of how to use of this widget.
class AnimatedImage : public Image
{
public:
AnimatedImage(const BitmapId& start, const BitmapId& end, const uint8_t& updateInterval = 1) :
Image(Bitmap(start)),
animationDoneAction(0),
startId(start),
endId(end),
updateTicksInterval(updateInterval),
ticksSinceUpdate(0),
reverse(false),
loopAnimation(false),
running(false)
{
}
AnimatedImage(const uint8_t& updateInterval = 1) :
animationDoneAction(0),
startId(BITMAP_INVALID),
endId(BITMAP_INVALID),
updateTicksInterval(),
ticksSinceUpdate(0),
reverse(false),
loopAnimation(false),
running(false)
{ }
virtual void startAnimation(const bool& rev, const bool& reset = false, const bool& loop = false);
virtual void stopAnimation();
virtual void pauseAnimation();
virtual void handleTickEvent();
void setDoneAction(GenericCallback< const AnimatedImage& >& callback)
{
animationDoneAction = &callback;
}
bool isRunning()
{
return isAnimatedImageRunning();
};
bool isAnimatedImageRunning()
{
return running;
};
bool isReverse()
{
return reverse;
};
void setBitmaps(BitmapId start, BitmapId end);
void setUpdateTicksInterval(uint8_t updateInterval);
virtual uint16_t getType() const
{
return (uint16_t)TYPE_ANIMATEDIMAGE;
}
protected:
GenericCallback<const AnimatedImage&>* animationDoneAction;
BitmapId startId;
BitmapId endId;
uint8_t updateTicksInterval;
uint8_t ticksSinceUpdate;
bool reverse;
bool loopAnimation;
bool running;
virtual void setBitmap(const Bitmap& bmp) {}
};
animationDoneAction
startId
endId
updateTicksInterval
ticksSinceUpdate
reverse
loopAnimation
running
Methods
startAnimation()
@fn virtual void AnimatedImage::startAnimation(const bool& rev, const bool& reset = false, const bool& loop = false); Starts the animation. Starts the animation.
Read more...
stopAnimation()
@fn virtual void AnimatedImage::stopAnimation(); Stops and resets the animation. Stops and resets the animation.
Read more...
pauseAnimation()
@fn virtual void AnimatedImage::pauseAnimation(); Toggles the running state of an animation. Toggles the running state of an animation. Pauses the animation if the animation is running. Continues the animation if previously paused.
Read more...
handleTickEvent()
setDoneAction()
@fn void AnimatedImage::setDoneAction(GenericCallback& callback) Associates an action to be performed when the animation of the AnimatedImage is done. Associates an action to be performed when the animation of the AnimatedImage is done.
Read more...
isRunning()
@fn bool AnimatedImage::isRunning() Gets the running state of the AnimatedImage. Gets the running state of the AnimatedImage.
Read more...
isAnimatedImageRunning()
@fn bool AnimatedImage::isAnimatedImageRunning() Gets the running state of the AnimatedImage. Gets the running state of the AnimatedImage.
Read more...
isReverse()
@fn bool AnimatedImage::isReverse() Query if this object is running in reverse. Query if this object is running in reverse.
Read more...
setBitmaps()
@fn void AnimatedImage::setBitmaps(BitmapId start, BitmapId end); Sets the bitmaps that are used by the animation. Sets the bitmaps that are used by the animation. The animation will iterate over the bitmaps that lies between the IDs of start and end, both included.
Read more...
setUpdateTicksInterval()
@fn void AnimatedImage::setUpdateTicksInterval(uint8_t updateInterval); Sets the update interval. Sets the update interval.
Read more...
getType() const
@fn virtual uint16_t AnimatedImage::getType() const For GUI testing only. For GUI testing only. Returns type of this drawable.
Read more...
setBitmap()
@fn virtual void AnimatedImage::setBitmap(const Bitmap& bmp) Is not public available. Use setBitmaps instead. Is not public available. Use setBitmaps instead. Internally in AnimatedImage use Image::setBitmap(...).
Read more...
Examples
touchgfx::AnimatedImage is referenced by
2 libraries and example projects.
Child classes
touchgfx::AnimatedImage