nCine::RectAnimation class

Contains data for a rectangles based animation.

Public types

enum class LoopMode { NoRepeat, FromStart, Backward }
Loop modes.

Constructors, destructors, conversion operators

RectAnimation()
Default constructor.
RectAnimation(float defaultFrameDuration, LoopMode loopMode)
Constructor for an animation with a specified default frame duration, loop and rewind mode.

Public functions

auto isPaused() const -> bool
Returns true if the animation is paused.
void setPaused(bool isPaused)
Sets the pause flag.
void updateFrame(float interval)
Updates current frame based on time passed.
auto frame() const -> unsigned int
Returns current frame.
void setFrame(unsigned int frameNum)
Sets current frame.
auto defaultFrameDuration() const -> float
Returns the default frame duration in seconds.
void setDefaultFrameDuration(float defaultFrameDuration)
Sets the default frame duration in seconds.
auto loopMode() const -> LoopMode
Returns the loop mode.
void setLoopMode(LoopMode loopMode)
Sets the loop mode.
void addRect(const Recti& rect, float frameTime)
Adds a rectangle to the array specifying the frame duration.
void addRect(int x, int y, int w, int h, float frameTime)
Creates a rectangle from origin and size and then adds it to the array, specifying the frame duration.
void addRect(const Recti& rect)
Adds a rectangle to the array with the default frame duration.
void addRect(int x, int y, int w, int h)
Creates a rectangle from origin and size and then adds it to the array, with the default frame duration.
auto rect() const -> const Recti&
Returns the current rectangle.
auto frameDuration() const -> float
Returns the current frame duration in seconds.
auto rectangles() -> SmallVectorImpl<Recti>&
Returns the array of all rectangles.
auto rectangles() const -> const SmallVectorImpl<Recti>&
Returns the constant array of all rectangles.
auto frameDurations() -> SmallVectorImpl<float>&
Returns the array of all frame durations.
auto frameDurations() const -> const SmallVectorImpl<float>&
Returns the constant array of all frame durations.

Enum documentation

enum class nCine::RectAnimation::LoopMode

Loop modes.

Enumerators
NoRepeat

FromStart

When the animation reaches the last frame it begins again from start.

Backward

When the animation reaches the last frame it goes backward.