Motion in Fusuma is data and arithmetic, not a second renderer. Everything runs in fixed point (Q16.16) against the app's own millisecond clock, so a spring behaves the same on a chip with no FPU as on a desktop, and a test can step it to the millisecond.
What is there
fusuma-anim is no_std and has no dependencies.
- Easing and tweens: a value from A to B over a time, by a curve.
- Keyframes and clips: several values over time, grouped and played together.
- Springs:
SpringwithSpringConfigpresets (GENTLE,WOBBLY,STIFF,SLOW,SNAPPY, andSPATIALfor where things are). A spring has no end time; it settles. - Fling decay and touch:
Touchmeasures a finger's velocity, and a scroll carries on by friction after the finger lifts. - Small helpers:
Bounce(gravity, a floor, restitution),damp,Shake,wanderanddrift,Stretch.
In a view
You rarely touch these directly. The view layer has views that move a node on a spring without running your view every frame:
animate(view)moves a view to wheretosays, on a spring.flipping(container)carries the children of a container to their new places when they move. Reorder a list and the rows glide: the toolkit remembers where each was, lets the layout put it where it belongs, and plays the difference. Up to eight children.present(when, view)brings a view in from an offset whilewhenis true and sends it back out when it is not, so a panel can slide in and out and still leave the tree when it has left.- A node can fade (
Fade), and a dialog fades the page and slides in; a bottom sheet rises from the bottom edge. - A shared element keeps its identity between two screens, and the move between them is animated.
Pictures that move
With the vector feature, LottieBox plays a Lottie animation and SvgBox draws an SVG, both through the same paths the widgets use. The frame clock plays the Lottie; it loops, plays once and holds its last frame, or is paused, and it asks for no more frames when it is paused or finished. Shaders (ShaderBox) draw a function of position and time into a box; the integer renderer runs them in one pass.
Motion and power
A frame is asked for only while something moves. When every spring has settled and every timer is waiting, the app sleeps and the platform does not redraw. That is also how an e-paper panel stays still.
The motion the theme allows is a budget: Full, Reduced (a watch) or Off (a reflective panel, or a person who asks for less motion). The design files hold the durations, and a view reads env.motion() to follow them.
See it move: the gallery has pages for effects, vector pictures and long lists, and the live demo runs all of them.