Animation

Series of animation frames played successively.

Constructors

this
this()

Empty animation.

this
this(Drawable tex, Vec2f size_, Vec4i[] clips_, int[] frames_)

Create an animation from a series of clips.

this
this(Drawable tex, Vec4i startTileClip, int columns, int lines, int maxcount, Vec2i margin)

Create an animation from a tileset.

this
this(Animation animation)

Copy ctor.

Members

Enums

Mode
enum Mode

Change the way the animation is playing. once: Play each frames sequencially then stop. reverse: Play each frames from the last to the first one then stop. loop: Like "once", but go back to the first frame instead of stopping. loopReverse: Like "reverse", but go back to the last frame instead of stopping. bounce: Play like the "once" mode, then "reverse", then "once", etc bounceReverse: Like "bounce", but the order is reversed.

Functions

advance
void advance()

Go to the next frame.

draw
void draw(Vec2f position)

Render the current frame.

draw
void draw(Vec2f position, int currentDir)

Render the current frame with a direction information.

pause
void pause()

Pauses the animation where it is.

reset
void reset()

Goes back to starting settings.

resume
void resume()

Resumes the animation from where it was.

setDefaultFrames
void setDefaultFrames()

Resets the frames to the default order.

start
void start()

Starts the animation from the beginning.

stop
void stop()

Stops and resets the animation.

update
void update(float deltaTime)

Run the animation.

Properties

currentFrame
int currentFrame [@property getter]

The current frame being used.

drawable
Drawable drawable [@property setter]
Drawable drawable [@property getter]

Drawable.

duration
float duration [@property getter]
float duration [@property setter]

Duration in seconds from witch the timer goes from 0 to 1 (framerate dependent). \ Only positive non-null values.

isPlaying
bool isPlaying [@property getter]

Is the animation currently playing ?

Variables

alpha
float alpha;

Alpha

anchor
Vec2f anchor;

Relative center of the sprite.

angle
float angle;

Angle in which the sprite will be rendered.

blend
Blend blend;

Blending algorithm.

clips
Vec4i[] clips;

Drawable regions (the source size) for each frames.

color
Color color;

Color added to the tile.

dirOffset
Vec2i dirOffset;

Clip offset for each direction.

dirs
int dirs;

Number of directions.

flip
Flip flip;

Mirroring property.

frames
int[] frames;

The order in which each frames is played.

maxDirs
int maxDirs;

Number of directions.

mode
Mode mode;

Behavior of the animation.

size
Vec2f size;

Destination size.

Meta