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

Length Unit mixing fails #62

Open Natim opened 6 years ago

Natim commented 6 years ago

If you try to do the following:

Animation.style [ Animation.top (percent 100) ]
    |> Animation.interrupt  [ Animation.to [ Animation.top (px -200) ] ]

Note the (px -200)

It actually goes to (percent -200)

Natim commented 6 years ago

In this case the solution I had in mind was to go to 0% and then switch to pixels.

But then you need a way to guess how many pixels might your 15% be.

            Animation.style [ Animation.top (percent 100) ]
                |> Animation.interrupt
                    [ Animation.loop
                        [ Animation.toWith (Animation.speed { perSecond = 15 })
                            [ Animation.top (percent 0) ]
                        , Animation.set [ Animation.top (px 0) ]
                        , Animation.toWith (Animation.speed { perSecond = 150 })
                            [ Animation.top (px -250) ]
                        , Animation.set [ Animation.top (percent 100) ]
                        ]
                    ]