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
440 stars 40 forks source link

Not setting animation speed results in broken animations #57

Open mikolajpp opened 6 years ago

mikolajpp commented 6 years ago

I had this code:

Animation.interrupt
                [ Animation.loop
                    [ Animation.to
                        [ Animation.rotate (Animation.turn 1) ]
                    , Animation.set [ Animation.rotate <| Animation.turn 0 ]
                    ]
                ]
                model.style

For a little spinner. The above results in one correct animation, and afterwards animations spinner only abruptly resets itself to 0 in jumps.

Using this:

  Animation.interrupt
                [ Animation.loop
                    [ Animation.toWith (Animation.speed { perSecond = 1 })
                        [ Animation.rotate (Animation.turn 1) ]
                    , Animation.set [ Animation.rotate <| Animation.turn 0 ]
                    ]
                ]
                model.style

(Note we set animation speed) fixes the problem.