Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struggled to understand how to create helpers #11

Open
lucamug opened this issue Apr 28, 2020 · 1 comment
Open

Struggled to understand how to create helpers #11

lucamug opened this issue Apr 28, 2020 · 1 comment

Comments

@lucamug
Copy link

lucamug commented Apr 28, 2020

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

@mdgriffith
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants