reference monoe.animation

Lua API Reference

Properties

NameTypeDescription
uidintegerUnique ID for the engine-side animation object

monoe.animation.new

Creates a new `monoe.animation` object.

Returns


monoe.animation:add

Adds a new animation by name.

Parameters

NameTypeDescription
namestringName of the animation

monoe.animation:addframe

Adds a frame to an animation.

Parameters

NameTypeDescription
namestringName of the animation
framemonoe.imageThe frame image to add
durationnumber|nilDuration of the frame in seconds (default 1.0)
indexinteger|nilIndex at which to insert the frame (-1 = append)

monoe.animation:play

Plays the specified animation.

Parameters

NameTypeDescription
namestringAnimation name
loopbooleanIf the animation should loop or not

monoe.animation:backwards

Plays an animation backwards.

Parameters

NameTypeDescription
namestringAnimation name
loopbooleanIf the animation should loop or not

monoe.animation:pause

Pauses the current animation.


monoe.animation:animations

Returns a list of all animation names.

Returns


monoe.animation:position

Sets or gets the position of the animation.

Parameters

NameTypeDescription
xnumber|nil
ynumber|nil

Returns


monoe.animation:move

Moves the animation by a given offset.

Parameters

NameTypeDescription
xnumber
ynumber

Returns


monoe.animation:scale

Scales the animation.

Parameters

NameTypeDescription
xnumber
ynumber

Returns


monoe.animation:flip

Flips the animation on a given axis.

Parameters

NameTypeDescription
statebooleanTrue to flip, false to reset

monoe.animation:load

Loads an animation from a sprite sheet image.

Parameters

NameTypeDescription
namestringAnimation name
imagemonoe.imageSource image
widthintegerFrame width
heightintegerFrame height
fromcolumnintegerStarting column
tocolumnintegerEnding column
fromrowintegerStarting row
torowintegerEnding row
fpsnumber|nilFrames per second (default 7.0)

monoe.animation:current

Returns the current played animation.

Returns


monoe.animation:finished

Calls the given function when an animation finishes.

Parameters

NameTypeDescription
funcfunction
isonceboolean

monoe.animation:free

Frees engine resources associated with this animation.


monoe.animation:remove

Removes the instance from the rendering side.