[Library] anim8 - An animation library - v2.3.0 released

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

[Library] anim8 - An animation library - v2.3.0 released

Post by kikito »

Hi there,

EDIT: I have just released anim8 v2.1.0. The only thing that changes in this version is LÖVE 0.9 compatibility.

Anim8 is always available on github:

https://github.com/kikito/anim8

So - what is this lib?

Its aim is making animations in a single call, in a human-friendly way - minimizing the amount of typing, when possible.

One way of reducing the amount of typing was "splitting" the information in two parts. The first part, I called "Grids", and basically are heavy-duty "Quad creators". Once a grid is created, I initially tought of specifiying the frames of an animation like this:

Code: Select all

grid({1,1}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7})
This is a lot of typing. I decided to leave the brackets out:

Code: Select all

grid(1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7)
That's better, but could be reduced further. For example, it's a very usual case that animations are "rows" or "columns" in the spritesheet. So I decided to allow using strings to define intervals. In anim8, the previous code can also be compressed to the following two params:

Code: Select all

grid(1,"1-7")
Of course, that style can be "mixed up" with numbers. This is equivalent to the previous line:

Code: Select all

grid(1,"1-6", 1,7)
Another feature I'm proud of is that grids can handle frame borders, or "offset", very easily - once you define those in the grid, it's just "transparent".

Once you have the frames(aka quads) you want, you just pass them on to the "animation". Although very convenient, you don't need to use a grid to provide the animation with the quads; you can create them by other means if you so wish. I recommend using grids whenever possible, because quads are "reused" aggressively; the lib never creates the same quad twice; it "caches" all quads in case it wants to reuse them.

Please give the demo and the README in github a look. Let me know if you have questions or find any bugs!

Attaching demos for LÖVE 0.8 / anim8 2.0 and LÖVE 0.9 / anim8 2.1
anim8-demo.love
v0.8.0-compatible demo
(64.2 KiB) Downloaded 1297 times
anim8-demo-0.9.love
v0.9.0-compatible demo
(64.31 KiB) Downloaded 1370 times
anim8-demo-0.10.love
v0.10.0-compatible demo
(64.38 KiB) Downloaded 1027 times
Changelog:

v2.3.0
  • Adds support for shearing (kx, ky parameters when drawing)
  • Adds Animation:getFrameInfo()
v2.2.0
  • Adds Animation:getDimensions()
v2.1.0
  • LÖVE version upped to 0.9.x
Last edited by kikito on Wed Feb 10, 2016 3:18 pm, edited 7 times in total.
When I write def I mean function.
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: [Library] anim8 - A different animation library

Post by jradich »

http://www.youtube.com/watch?v=YKUOB8MN4Kc
I like this. I'll actually be able to do animation stuff.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
User avatar
Shooby
Prole
Posts: 1
Joined: Fri Mar 02, 2012 12:30 pm

Re: [Library] anim8 - A different animation library

Post by Shooby »

Great, thanks a bunch! I love all the libraries you have made so far.

It would seem like there is a tiny mixup in the GitHub documentation:

Code: Select all

anim8.newAnimation(mode, defaultDelay, frames, delays)
Should probably be:

Code: Select all

anim8.newAnimation(mode, frames, defaultDelay, delays)
Confused me for a moment :crazy:

Edit: Oh, you did mention the documentation was still in progess. My bad.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [Library] anim8 - A different animation library

Post by kikito »

Indeed. I have finished the doc just now. I'm updating the OP.

EDIT: updated, with new demo and descriptions.
When I write def I mean function.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: [Library] anim8 - A different animation library

Post by tsturzl »

Cool library, basically solved the only problem I had with AnAL.

Often times the sprite sheets my artist make end up having one or two blank spaces. I also thinks its pretty nifty to put more than one animation on a sprite sheet.

I like the fact that you simplified the grid function too, setting that many arguments every time you create an animation would be agonizing.

Perhaps a cool feature would be if you set the speed to negative it would play in reverse.
User avatar
kexisse
Citizen
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: [Library] anim8 - A different animation library

Post by kexisse »

anim8 saved me a bunch of time. Thanks for making it!

I have a question though, how would it be best to modify the delays on-the-fly?
I'm imagining that my animation would play faster as my character runs faster (kind of like Mario).
AlexBryant
Prole
Posts: 3
Joined: Tue Jul 03, 2012 6:37 pm

Re: [Library] anim8 - A different animation library

Post by AlexBryant »

Excuse me for being a noob, but as I'm entirely new to Love, is there a tutorial for this? And where do you put the anim8 script?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [Library] anim8 - A different animation library

Post by kikito »

Hi AlexBryant, welcome!
is there a tutorial for this?
The nearest thing I know is the Readme that comes with anim8, but it's meant to be read by someone who is already familiar with at least the basics of Löve and Lua. I recommend you to learn those first. For those, I do have a tutorial - https://github.com/kikito/love-tile-tutorial/wiki (Start on Chapter 0 - Basic Stuff).
And where do you put the anim8 script?
You can put it next to main.lua . Then you require it in main.lua doing this:

Code: Select all

-- this goes in main.lua
local anim8 = require 'anim8'
That is the way it is used in the demo file, attached on the first post. If you are curious, change its extension from .love to .zip and you will be able to open/uncompress it (love files are zip files with their extension changed).
When I write def I mean function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [Library] anim8 - A different animation library

Post by kikito »

kexisse wrote:I have a question though, how would it be best to modify the delays on-the-fly?
I apologize - I didn't see this question before.

Animations have a public attribute called "delays". It's a simple table of numbers, one per frame. If you need to, you can modify that table manually. There is no way to do that "nicely" - I might add it.
When I write def I mean function.
User avatar
clofresh
Citizen
Posts: 87
Joined: Sun Jul 26, 2009 4:21 pm
Contact:

Re: [Library] anim8 - A different animation library

Post by clofresh »

I love anim8! Makes animation so much easier.

Question: Is there a way to ask an animation for the bounding box of the non-transparent area of the current frame? It'd like to use it for collision detection where collisions correspond directly to the drawn pixels, but a grid cell is the size of the largest animation frame so many frames have a padding of transparent pixels to make them uniform size. Doesn't have to be the exact shape, a rectangle would do fine.
----------------------------------------
Sluicer Games
Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests