@animaly/motion
v0.2.2
Published
motion's animate, motionValue and stagger running on animaly: a drop-in import swap.
Maintainers
Readme
@animaly/motion
motion's animate, motionValue and stagger, running on animaly. Replace the import and keep your code:
import { animate, motionValue, stagger } from "@animaly/motion";
animate(".card", { x: 120, opacity: 1 });
animate(".dot", { scale: [1, 1.4, 1] }, { duration: 0.6, delay: stagger(0.05, { from: "center" }) });
animate([
[".title", { y: [20, 0], opacity: [0, 1] }],
[".body", { opacity: [0, 1] }, { at: "-0.1" }],
]);Supported:
- motion's default transitions, per-value transitions with
defaultandinherit,from,type: false,transitionEnd - springs by physics or by
duration,bounceandvisualDuration, using motion's solver repeat,repeatType(loop, reverse, mirror),repeatDelay, negative delays- sequences with
at, labels, motion values, callback segments and spring segments - all of motion's named eases, cubic bezier arrays and easing functions;
createMotion({ bezier: "motion" })uses motion's own bezier solver for exact parity - controls with motion's
time,duration,iterationDuration,state,speed, replay after finishing onUpdateper value for elements, objects and single values; motion values with motion'ssetandjump- motion's color mixing
Checked against motion v13.4.6: 116 of motion's own tests (animate, sequences, motion values, elements, stagger) run against this package, and 30 transitions are compared with motion's animate frame by frame (equal within 1e-6).
Known differences:
- Inertia with
min/maxbounces from the exact moment it crosses the boundary. motion detects the boundary while it steps the animation every 50ms to estimate its duration, so its spring starts at the first 50ms step past the boundary and the value overshoots further: atvelocity: 1200, max: 150it peaks at 285.9 where animaly peaks at 231.9. - A value set with
set()while animating is shown until the next frame, like motion, butget()in between returns the animated value.
Not yet: repeating springs, %, vw and em on transforms, attachTimeline. These throw an error that names them.
Pre-release: the API can still change. Parts of motion are ported under its MIT license; see NOTICE.
