elm-animator icon indicating copy to clipboard operation
elm-animator copied to clipboard

Struggled to understand how to create helpers

Open lucamug opened this issue 5 years ago • 1 comments
trafficstars

I needed to change the scaleX and scaleY independently and it was not trivial to understand that is possible to create helpers like.

I think either adding this as example in the documentation or including the most important in the code could be beneficial for beginners.

scaleXY : Timeline state -> (state -> { x : Movement, y : Movement }) -> Html.Attribute msg
scaleXY timeline lookup =
    let
        pos =
            Animator.xy timeline lookup
    in
    Html.Attributes.style "transform"
        ("scaleX(" ++ String.fromFloat pos.x ++ ") scaleY(" ++ String.fromFloat pos.y ++ ")")

Thanks to @dmy to came out with the idea for this helper

lucamug avatar Apr 28 '20 08:04 lucamug

Good call, the documentation could be clearer in showing people how to "manually" put these together.

mdgriffith avatar May 03 '20 19:05 mdgriffith