An animation Library for use with Gideros Studio

View project onGitHub


An animation Library for use with Gideros Studio

This is helpful for creating and using spritesheets. It can be used with spritesheets that are laid out horizontally.

Frame1 | Frame2 | Frame3 | Frame4 | Frame5 | ...

You can initialise the animation with

local myAnim ="anim1.png", 6, 4, 1)
where the syntax is, maxFrames, tickSpeed, scale)
imageFileName is the image that holds all the images horizontally <-- This is important
maxFrames tells the animation the number of frames that the image has.
The dimensions of this image should be FrameWidth x maxFrames
tickSpeed is what determines the speed at which the animation is updated.
While some animations work on time, this one is set up on frames to skip before updating
scale is used if you want to scale your animation to a smaller size (fit retina animation on a normal device)

The other functions available with this library are
the frameNumber is between 1 and maxFrames
starts playing the animation. Generaly automatically started when a new instance is created
toggles the playing of the animation
stops the animation and sets the frame to the atFrame or the first frame
animation:setPosition(xPos, yPos)
positions the animation sprite to the position xPos, yPos on the screen
sets the position of the x co-ordinate of the sprite
sets the position of the y co-ordinate of the sprite
sets the alpha of the sprite
animation:setScale(xScale, yScale)
sets the scale of the sprite, if only one value is passed, it is applied to both x and y
This is used to make the sprite part of another sprite object than the stage.

License: If you use this code, you need to attribute it to the Author Jayant C Varma from OZApps ( in your credits. If you feel that you would rather pay than to credit, you can make a payment of $25 via PayPal instead.