Struggled to understand how to create helpers
lucamug opened this issue · comments
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
Good call, the documentation could be clearer in showing people how to "manually" put these together.