Animation
Remember that Animations must be updated each frame. (See example)
Functions
addFrame( x, y, w, h, delay ) | Adds a single frame to the Animation. |
setMode( mode ) | Sets the animation mode. |
play( ) | Starts the Animation. |
stop( ) | Stops the Animation |
reset( ) | Sets the current frame to the first frame and resets timer. |
seek( frame ) | Sets the current frame. |
getCurrentFrame( ) | Gets the current frame number |
getSize( ) | Gets the number of frames. |
setDelay( frame, delay ) | Sets the delay of a specific frame. |
setSpeed( speed ) | Sets the overall speed of the Animation. |
getSpeed( ) | Returns the current speed of the Animation. |
getWidth( ) | Gets the width of the current frame. |
getHeight( ) | Gets the height of the current frame. |
setCenter( x, y ) | Changes the center of the Animation. |
update( dt ) | Updates the Animation |
Examples
Example 1:
function load()
src = love.graphics.newImage("source.png")
anim = love.graphics.newAnimation(src, 32, 32, 0.1, 0)
anim:play()
end
function update(dt)
anim:update(dt)
end
function draw()
love.graphics.draw(anim, 50, 50)
end