martinjlowm / AnimationGroup

Animations for WoW 1.12
MIT License
8 stars 3 forks source link

Bounce once? #3

Open tdymel opened 7 years ago

tdymel commented 7 years ago

Hey! I'd like to to create an animation like you had shown on the gif. Problem is I can't see any way to create this animation.

The current problem is that it is resetting after every animation to default. What Id like to do is to execute animation 1 at order 1, animation 2 at order 2 and animation 3 meanwhile.

Also I think an Bunce once option could be very useful

cheers!

martinjlowm commented 7 years ago

You should be able to listen to the OnLoop handler when all animations are complete and then call Finish() on the animation group.

tdymel commented 7 years ago

Alright, thanks!

tdymel commented 7 years ago

Is it inteded that GetLoopState() always returns nil?

tdymel commented 7 years ago

You forgot to add "OnLoop" to your default event handlers. The handler is working fine though.

self.handlers = { ['OnLoad'] = true, ['OnPlay'] = true, ['OnPaused'] = true, ['OnStop'] = true, ['OnFinished'] = true, ['OnLoop'] = true }

martinjlowm commented 7 years ago

The loop thing is only partly implemented. It is not intended that GetLoopState returns nil, no :) The handler is left out from the table since it does not exist in the game by default. The others are meant for overriding.

tdymel commented 7 years ago

Btw what happens if I call finish after the Loop event handler, it will just continue scaling instead of going back to normal state, is that intended? Also should it fire OnLoop if it reached the peak or if it is back to default? cheers!

tdymel commented 7 years ago

Not sure how it was inteded, but incase you are thinking about it, I switched line 356-366, the two blocks to ensure only on repetation after the finish call.

-- We `bounce' if the boundary orders have no animations if (not self.playing and shift and (not self.finishing) and bouncing) then self.reverse = not self.reverse self:__Notify(nil, 'Bounce') end

-- Call AnimationGroup's callback
if type(group_func) == 'function' then
    group_func(self, unpack(args))
end

cheers!