Manager Of TImed Object aNimations

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
TimeLoop
Prole
Posts: 28
Joined: Wed Apr 17, 2013 8:20 am

Manager Of TImed Object aNimations

Post 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.
Attachments
example.love
Example
(14.5 KiB) Downloaded 134 times
motion.lua
MOTION library
(2.7 KiB) Downloaded 109 times
Last edited by TimeLoop on Mon Aug 19, 2013 9:08 am, edited 2 times in total.
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Manager Of TImed Object aNimations

Post 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!
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
Daniel Eakins
Citizen
Posts: 99
Joined: Thu Jul 18, 2013 9:14 pm
Location: France

Re: Manager Of TImed Object aNimations

Post by Daniel Eakins »

For a newcomer to Löve, what is the advantage of using this over kikito's anim8 library?
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Manager Of TImed Object aNimations

Post 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.
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
TimeLoop
Prole
Posts: 28
Joined: Wed Apr 17, 2013 8:20 am

Re: Manager Of TImed Object aNimations

Post 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.
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Manager Of TImed Object aNimations

Post 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.
Attachments
06kBYqv.png
06kBYqv.png (1.29 KiB) Viewed 345 times
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
TimeLoop
Prole
Posts: 28
Joined: Wed Apr 17, 2013 8:20 am

Re: Manager Of TImed Object aNimations

Post 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!!!
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Manager Of TImed Object aNimations

Post 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.
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Manager Of TImed Object aNimations

Post 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:
When I write def I mean function.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Manager Of TImed Object aNimations

Post 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.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests