Hi everyone!
This is very much a work in progress, but I thought it would be useful to get some feedback / temperature check on the idea and the api so far.
Some background
I’ve been implementing some animations at work and on a few personal projects, and I often find myself in this position:
- My animations are so simple that maybe I could write a bit of CSS and get away with it
- But as soon as they get a little bit more complex they become quite brittle and irritating to maintain
- I’ll reach for the fantastic
elm-animator
and wire everything in - But then there’s an awful lot of wiring, and particularly when these animations don’t need powerful things like interruptions, it makes me think - is there a middle ground between the two approaches?
I’ve been putting together elm-simple-animation
(working title) that uses a similar technique to elm-animator
to generate CSS keyframes and a stylesheet under the hood and renders the animation on the page - but without any of the state machinery.
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 ]
Can give you something like:
Questions
It would be great to hear some thoughts on these questions:
- Would this be useful to anyone?
- Does the API make sense?
- Is this something that could live alongside
elm-animator
?
Here is the api doc preview (haven’t published the library yet) - https://elm-doc-preview.netlify.app/?repo=andrewmacmurray%2Felm-simple-animation
Repo is here - https://github.com/andrewMacmurray/elm-simple-animation
Some live examples here - https://elm-simple-animation-examples.surge.sh/
Any thoughts or feedback would be much appreciated