Page 6 of 9

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

Posted: Mon Apr 27, 2015 12:52 am
by konacake
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.

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

Posted: Mon Apr 27, 2015 5:44 pm
by s-ol
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.

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

Posted: Mon Apr 27, 2015 10:39 pm
by kikito
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.

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

Posted: Sun May 17, 2015 3:43 pm
by SouL
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.

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

Posted: Sun May 17, 2015 5:33 pm
by s-ol
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

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

Posted: Fri Jan 29, 2016 4:45 pm
by bobbyjones
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.

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

Posted: Wed Feb 10, 2016 3:11 pm
by kikito
I am releasing anim8 v 2.3.0 today!

It adds a couple things:

* 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

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

Posted: Wed Feb 10, 2016 4:16 pm
by zorg
In all honesty, you did most of the work, so thanks to you, kikito! :3

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

Posted: Thu Feb 11, 2016 4:25 am
by bobbyjones
Yay, but as zorg said, I did nothing but complain lol.

edit: 500th post \o/

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

Posted: Tue Oct 18, 2016 4:07 pm
by Jack Dandy
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))