I think I understand this, but let me run it past you all to check.

I notices that some of my animations are happening in sequence instead of 
in parallel. That is one animation must complete before the next begins.

I set up the animation subscriptions like this:

subscriptions : Model -> Sub Msg
subscriptions model =
    List.map
        (\zipper ->
            Animation.subscription (Animate zipper)
                [ Zipper.datum zipper |> .controlBarStyle ]
        )
        (collectAnimatedNodes model.contentTree)
        |> Sub.batch

The idea being that each Animate message is associated with a zipper, to 
tell it which part of a tree needs updated. The state for this particular 
piece of the application is held in an elm-multiway-tree-zipper 
(http://package.elm-lang.org/packages/tomjkidd/elm-multiway-tree-zipper/latest).
 
The way to associate a message with part of the tree is to pass a zipper, 
which also means that my Animate messages are each associated with just one 
thing that needs animated.

When an Animate message is passed to 'update' is just update one part of 
the tree:

    Animate zipper msg ->
            case updateControlBarAnimation (Animation.update msg) zipper of
                Nothing ->
                    ( model, Nothing )

                Just newTree ->
                    ( { model | contentTree = newTree }, Nothing )

In another part of my application, when I get an Animate message, I update 
_all_ animations, and this does display the animations running in parallel:

    Animate msg ->
            ( { model
                | menuStyle = Animation.update msg model.menuStyle
                , slideButtonStyle = Animation.update msg 
model.slideButtonStyle
              }
            , Cmd.none
            )

So I think that Animate messages are sent out on a timer, one per tick, 
rather than one per animation needing updated? I was assuming that 
Animation.subscription would generate one Animate message per animation 
needing updated, so if two updates occurred on the same tick there would be 
2 messages. This seems not to be the case.

-- 
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