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

konacake
Prole
Posts: 11
Joined: Mon Mar 03, 2014 4:35 am

### Re: [Library] anim8 - An animation library - v2.1.0 released

Ah, thank you kikito, I finally get it. Honestly I prefer to put in the coordinates in manually, rather than using your string shortcut, but it is a nice feature once you get used to it. Thanks again for the work you put in to all your wonderful libraries, you make the best ones.

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: [Library] anim8 - An animation library - v2.1.0 released

I think it would be nice if every (x, y) pair would be one string:

"1, 2"
"2-3, 2"
"5, 4-7"
"2-3, 9-10"

then dealing with the varargs would get easier in trade for slightly more complex parsing (split at comma, tonumber() if theres no dash).
I think that looks a lot cleaner, mixing strings and numbers always felst (slightly) dirty for some reason.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Contact:

### Re: [Library] anim8 - An animation library - v2.1.0 released

It was like that initially, but I removed it later on. Almost always it's the same amount of characters, and it simplifies the parsing quite a lot.
When I write def I mean function.

SouL
Prole
Posts: 14
Joined: Mon Jun 30, 2014 1:33 pm

### Re: [Library] anim8 - An animation library - v2.1.0 released

Hello.

What would be the approach to accomplish the following:

I have a button and a sprite with two movements. The attack movement and the idle movement. The sprite is always being animated with the idle movement. When I click the button, I want to change the animation to the attack one and when finishing the attack, return to the idle animation.
Also, is possible to get the exact moment of the end of the attack to trigger another event?

Thanks for any answer, I'm really new into Löve and Lua.

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: [Library] anim8 - An animation library - v2.1.0 released

SouL wrote:Hello.

What would be the approach to accomplish the following:

I have a button and a sprite with two movements. The attack movement and the idle movement. The sprite is always being animated with the idle movement. When I click the button, I want to change the animation to the attack one and when finishing the attack, return to the idle animation.
Also, is possible to get the exact moment of the end of the attack to trigger another event?

Thanks for any answer, I'm really new into Löve and Lua.
For the end of the attack, you can put an "onLoop" function:

Code: Select all

animation.onLoop = function () -- do something end
for multiple animations, here is what I usually do:

Code: Select all

function Player.new()
local self = {} -- whatever you are doing here

self.idle     = IDLE_ANIM:clone() -- the anim8 idle animation
self.attack = ATTACK_ANIM:clone()
self.attack.onLoop = function () self:attackDone() end
self.anim   = self.idle

return self
end

function Player:update(dt)
self.anim:update(dt)

if not self.attacking and love.keyboard.isDown" " then
self.attacking = true
self.anim = self.attack
end
end

function Player:draw()
self.anim:draw()
end

function Player:attackDone()
-- do something
end

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

bobbyjones
Party member
Posts: 728
Joined: Sat Apr 26, 2014 7:46 pm

### Re: [Library] anim8 - An animation library - v2.1.0 released

Does anim8 support spritebatches?

Edit: If it doesn't I could add that in this weekend and submit a PR. Although the api probably would have to be changed to reflect that.
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Contact:

### Re: [Library] anim8 - An animation library - v2.1.0 released

I am releasing anim8 v 2.3.0 today!

* spritebatch support (thanks to bobbyjones and zorggn for their invaluable feedback in resolving this)
* better handling of the shear factor params (kx,ky) when drawing / blitting to a spritebatch

I have also written a small demo showing spritebatches and shearing working together. It can be found on the spritebatch-demo branch: https://github.com/kikito/anim8/tree/spritebatch-demo
When I write def I mean function.

zorg
Party member
Posts: 2793
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

In all honesty, you did most of the work, so thanks to you, kikito!
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

bobbyjones
Party member
Posts: 728
Joined: Sat Apr 26, 2014 7:46 pm

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

Yay, but as zorg said, I did nothing but complain lol.

edit: 500th post \o/
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

Jack Dandy
Prole
Posts: 49
Joined: Mon Sep 08, 2014 4:26 pm

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

Hey there, first off- THANKS very much for this cool, handy library!

Now, I have a question.
In the readme in https://github.com/kikito/anim8, it says:
onLoop is an optional parameter which can be a function or a string representing one of the animation methods. It does nothing by default. If specified, it will be called every time an animation "loops". It will have two parameters: the animation instance, and how many loops have been elapsed. The most usual value (apart from none) is the string 'pauseAtEnd'. It will make the animation loop once and then pause and stop on the last frame.
Now, let's say I supply my own little function.
But I don't exactly understand, how am I supposed to access the two parameters you talked about in the quote?

For example, the following didn't work.

Code: Select all

slashAnim = anim8.newAnimation(animgrid('1-6',1), 0.04, (function(a,b) DRAWSLASH=false  a:pauseAtEnd() end))

### Who is online

Users browsing this forum: No registered users and 16 guests