andrewMacmurray / elm-simple-animation

stateless animation utils for Elm
https://package.elm-lang.org/packages/andrewMacmurray/elm-simple-animation/latest/
MIT License
50 stars 3 forks source link

Include imports in examples #6

Closed MartinSStewart closed 3 years ago

MartinSStewart commented 3 years ago

A few of the code examples have things like P.x in them. I had no idea what this was until I opened up the documentation on elm-packages and saw that one of the modules is Simple.Animation.Property. From there I inferred that P was an alias for Simple.Animation.Property.

I think it would be easier if, for example,

animatedDot : Html msg
animatedDot =
    Animated.div expandFade [ class "dot" ] []

expandFade : Animation
expandFade =
    Animation.fromTo
        { duration = 2000
        , options = [ Animation.loop ]
        }
        [ P.opacity 1, P.scale 1 ]
        [ P.opacity 0, P.scale 2 ]

was instead

import Simple.Animated as Animated
import Simple.Animation as Animation
import SimpleAnimation.Property as P

animatedDot : Html msg
animatedDot =
    Animated.div expandFade [ class "dot" ] []

expandFade : Animation
expandFade =
    Animation.fromTo
        { duration = 2000
        , options = [ Animation.loop ]
        }
        [ P.opacity 1, P.scale 1 ]
        [ P.opacity 0, P.scale 2 ]
andrewMacmurray commented 3 years ago

Good idea, happy for you to make a PR if you have time?

andrewMacmurray commented 3 years ago

closed with #7