This file shows how multiple animations can be run through one Animate Msg:

https://github.com/mdgriffith/elm-style-animation/blob/master/examples/Gears.elm


You basically make your subscription like this:

Animation.subscription Animate
    [ model.annulus
    , model.sun
    , model.smallPlanet
    , model.largePlanet
    , model.mediumPlanet
    ]

And your Animate Msg in your update function would look like this:

Animate animMsg ->
    let
        annulus =
            Animation.update animMsg model.annulus

        sun =
            Animation.update animMsg model.sun

        smallPlanet =
            Animation.update animMsg model.smallPlanet

        mediumPlanet =
            Animation.update animMsg model.mediumPlanet

        largePlanet =
            Animation.update animMsg model.largePlanet

        global =
            Animation.update animMsg model.global
    in
        ( { model
            | annulus = annulus
            , sun = sun
            , smallPlanet = smallPlanet
            , mediumPlanet = mediumPlanet
            , largePlanet = largePlanet
            , global = global
          }
        , Cmd.none
        )


The only thing this buys you compared to breaking out every animation into 
a separate Msg, is that your update function may be a little shorter.  

So the way you're doing it is fine:)

Try compiling with '--warn', it'll tell you all the type signatures and you 
can copy paste :D  




On Friday, December 2, 2016 at 12:11:31 PM UTC-5, Rex van der Spuy wrote:
>
>
>
> On Friday, December 2, 2016 at 11:46:49 AM UTC-5, Matthew Griffith wrote
>>
>>
>> First, (and this is kinda unrelated to organization) but I'd recommend 
>> using elm-format and having type signatures.
>>
>
> ... guilty as charged! :)
> I actually could never get elm-format to integrate with Sublime Text 
> despite many attempts - no idea why.
> Type signatures... I'll try using them more often! (... the compiler 
> scares me sometimes, so I usually just let it try and figure all the types 
> out on its own.)
>  
>
>>
>>
>> Side note, you can combine all your animation subscriptions into one 
>> message.
>>
>
> Oh, I think this is something I fundamentally don't understand about 
> elm-style-animation.
> Could you point me to reference on how to set that up?
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to