mdgriffith / elm-style-animation

The style animation library for Elm!
http://package.elm-lang.org/packages/mdgriffith/elm-style-animation/latest
BSD 3-Clause "New" or "Revised" License
441 stars 41 forks source link

Animation.isRunning not exposed #49

Closed emilianobovetti closed 7 years ago

emilianobovetti commented 7 years ago

In my view function I need to know if an animation is running to show appropriate elements accordingly. I noticed the function Animation.isRunning and I'm wondering if there is a reason why it's not exposed or if I'm using the wrong approach. Thank you.

mdgriffith commented 7 years ago

Would using Animation.Messenger.send to send a Msg at the end of a step work?

emilianobovetti commented 7 years ago

Of course I see there are alternatives, but in that case I should add a field to my application model, send a message and set the field while Animation.Model.Animation already stores this information and Animation.isRunning reads it, it's just not exposed. Am I missing something?

mdgriffith commented 7 years ago

I hear that, but I don't think using isRunning directly will lead you down a nice road. Here's what I'm thinking:

The problem is that then you're saying "have this action occur whenever this animation isn't running". What if the animation is interrupted halfway through to go to some other target where you don't want that trigger?

I'm guessing here, but likely for your specific situation you've made it so that this animation isn't going to be interrupted.

Basically using Animation.Messenger is more specific and will keep you in a nice place if you need to build on things later.

emilianobovetti commented 7 years ago

It sounds reasonable, thank you for prompt reply and for the pointer. Cheers!