Page 1 of 2

Manager Of TImed Object aNimations

Posted: Sun Aug 18, 2013 5:15 pm
by TimeLoop
Manager Of TImed Object aNimations (MOTION) is a small library that will manage for you your graphical animations.

Actual version: 1.0

It is as easy to use as including only three lines of code, plus the require "motion" line.


Actual functionalities:

Code: Select all

motion.newAnimation(<name:string>, <frames:table>, <interval:table/number/0>) : creates a new animation
motion.update([name:string]) : updates animations
motion.setFrame(<name:string>, <frame:number>) : changes an animation frame to the specified frame number
motion.get(<name:string>) : returns the image corresponding to the specified animation
motion.delete(<name:string>, [frameNum:number]) : removes the specified animation
motion.info(<name:string>) : returns the number of frames and the actual frame of the specified animation

Ofc more functionalities are in the ToDo, such as. Deleted items are already implemented and released.
- use timing tables, so each frame can have a different duration 1.0
- allow to define frames in different ways instead of having to provide every file name
- delete animation (could do this version but I was a bit lazy) 1.0
- function to get info about specified animation 1.0
- looping and non-looping animations (are destroyed once the animation reaches the last frame)
- non-autoupdateable animations, so you can specify when go to the next frame. 1.0
- something else?

Get the .lua right now!!!

Also available, an example showing most of the functionalities.

Enjoy.

Re: Manager Of TImed Object aNimations

Posted: Sun Aug 18, 2013 7:09 pm
by Eamonn
Seems nice. Better then AnAL. My question: Can I have more than 4 frames in 1 animation? Also, could you add support for spritesheets? For example, could you add something like this:

You can add 4 spritesheets with an infinite amount of frames per sheet. Then, you could say:

myAnim.get("myAnim").getSheet(1)

Sheet 1 would be the first sheet you pass in as a parameter.

Other than that, great library! I'll showcase this in my LÖVE tutorial series.

EDIT: Wow.... this library is incredible! From a code point of view I mean. You got that code to be 41 lines of code! Removing comments and un necessary line spaces your library's amount of lines weighs in at a whopping 26 lines of code. Amazing! Defiantly have to show this library in my series!

Re: Manager Of TImed Object aNimations

Posted: Sun Aug 18, 2013 9:54 pm
by Daniel Eakins
For a newcomer to Löve, what is the advantage of using this over kikito's anim8 library?

Re: Manager Of TImed Object aNimations

Posted: Sun Aug 18, 2013 10:31 pm
by Eamonn
Daniel Eakins wrote:For a newcomer to Löve, what is the advantage of using this over kikito's anim8 library?
I checked out anim8.. it looks like a headache to work with. For me at least this library is easier to use.

Re: Manager Of TImed Object aNimations

Posted: Sun Aug 18, 2013 10:56 pm
by TimeLoop
Eamonn wrote:Seems nice. Better then AnAL. My question: Can I have more than 4 frames in 1 animation?
You can add the number of frames you want. Those 4 was only an example.
Eamonn wrote: Also, could you add support for spritesheets? For example, could you add something like this:
Sprite sheet = tileset?

Because i'm not sure what are you talking about.
But if you are talking about tilesets, yes, that is a planned feature, but i need to think of a way to not add a bunch of complexity.
In either case, you can use a for...end loop and add animation frames from a quad, which should work right now, if that is what are you talking about.

Daniel Eakins wrote:For a newcomer to Löve, what is the advantage of using this over kikito's anim8 library?
I never heard nor used anim8 library, so I can't comment on that.

Re: Manager Of TImed Object aNimations

Posted: Sun Aug 18, 2013 11:28 pm
by Eamonn
TimeLoop wrote:
Eamonn wrote:Also, could you add support for spritesheets? For example, could you add something like this:
Sprite sheet = tileset?

Because i'm not sure what are you talking about.
But if you are talking about tilesets, yes, that is a planned feature, but i need to think of a way to not add a bunch of complexity.
In either case, you can use a for...end loop and add animation frames from a quad, which should work right now, if that is what are you talking about.
Kind of, yeah. This is a spritesheet. I suppose I could split them myself. You could add a frameWidth and frameHeight argument when you call the constructor, but also have a "spriteSheet" argument in the constructor. If this is false, you can leave the frameWidth and frameHeight argument blank. Just an idea. It's basically a lot of sprite frames in 1 image. That was just an example of 2 frames, each frame being 32x32.

Re: Manager Of TImed Object aNimations

Posted: Mon Aug 19, 2013 7:23 am
by TimeLoop
Eamonn wrote:Kind of, yeah. This is a spritesheet
I can only see a blue thing with some circles and squares.

But I think you are talking about quads. Isn't it?

That could be easy to implement.

[EDIT]

New version released, check out the first post for details. A lot of functionalities added!!!

Re: Manager Of TImed Object aNimations

Posted: Mon Aug 19, 2013 2:55 pm
by Eamonn
TimeLoop wrote:
Eamonn wrote:Kind of, yeah. This is a spritesheet
I can only see a blue thing with some circles and squares.

But I think you are talking about quads. Isn't it?

That could be easy to implement.

[EDIT]

New version released, check out the first post for details. A lot of functionalities added!!!
Yep. I haven't worked with quads a lot, but AFAIK they are quads.

Re: Manager Of TImed Object aNimations

Posted: Mon Aug 19, 2013 8:46 pm
by kikito
Eamonn wrote:I checked out anim8.. it looks like a headache to work with. For me at least this library is easier to use.
I'm always eager to find new ways to improve my libraries. Which part in particular would you say it was more difficult for you to grasp? (I recommend answering on anim8's thread, so we don't derail this one too much. Thanks! :ultraglee:

Re: Manager Of TImed Object aNimations

Posted: Tue Aug 20, 2013 3:28 am
by Davidobot
kikito wrote:
Eamonn wrote:I checked out anim8.. it looks like a headache to work with. For me at least this library is easier to use.
I'm always eager to find new ways to improve my libraries. Which part in particular would you say it was more difficult for you to grasp? (I recommend answering on anim8's thread, so we don't derail this one too much. Thanks! :ultraglee:
I actually prefer anim8 over AnAl, I find it simpler to use.
And if someone from outside the love community looks at my source code,they won't have any questions.