A comprehensive Elm package for smooth, high-performance DOM animations and scrolling.
prefers-reduced-motion: reduceDefine an animation once, then run it with any engine — no rewrites:
fadeIn : AnimBuilder eng -> AnimBuilder eng
fadeIn =
Opacity.begin
>> Opacity.from 0
>> Opacity.to 1
>> Opacity.end
Transition.animate model.animState <|
Transition.for "entrance"
>> fadeIn
Keyframe.animate model.animState <|
Keyframe.for "entrance"
>> fadeIn
Sub.animate model.animState <|
Sub.for "entrance"
>> fadeIn
-- … and WAAPI, ScrollTimeline and ViewTimeline take the same definitionScrolling follows the same define-once philosophy across the Cmd, Task and Sub scroll engines.
elm install phollyer/elm-motionThe WAAPI, ScrollTimeline and ViewTimeline engines also need the JavaScript companion:
npm install @phollyer/elm-motionThe companion carries its own version — any 1.x companion works with any 1.x Elm package.
Step-by-step guides for your first animation and first scroll live in the docs:
Full documentation, property reference and live examples: phollyer.github.io/elm-motion
See the npm package README for setup, port wiring and error reporting.
linear easing functionElm Motion is free and open source, built in my own time. If it helps you or your team, please consider sponsoring on GitHub — monthly or a one-time amount. It directly supports ongoing development.
Uses code from linuss/smooth-scroll.
The JavaScript companion bundles scroll-timeline-polyfill (Apache-2.0).
BSD-3-Clause