Animation API
Declared by <huxerui/animation.h>.
Curves and specifications
Section titled “Curves and specifications”Easing:Linear,EaseIn,EaseOut, orEaseInOut.CubicBezierCurve(x1, y1, x2, y2): custom control points exposed byX1,Y1,X2, andY2.TimingCurve: variant ofEasingor cubic Bézier.SnapSpec: immediate target.TweenSpec:durationandeasing.SpringSpec:stiffnessanddamping_ratio.ProgressKeyframe:fraction,progress, andcurve_to_next.KeyframeSpec(duration, keyframes): validated ordered keyframes exposed byDuration()andKeyframes().AnimationSpec: variant of all four spec kinds.
Playback and controller
Section titled “Playback and controller”RepeatMode:RestartorReverse.AnimationPlayback:delay, optionaliterations, andrepeat_mode.MotionAdvanceResult: progress and whether another frame is required.MotionController: inspectValue,Target,Velocity, andIsRunning; change motion withSet,Seek,AnimateTo, andAdvance.
View animation
Section titled “View animation”Animated<T>couples target value,AnimationSpec, and playback.AnimateTo(target, spec, playback = {})constructs it.- Presentation properties:
Opacity,Offset,Scale, andRotation. TransformOrigincontrols scale/rotation origin.Transition(progress)accepts a float orAnimated<float>and addsOpacity(from, to),Offset(from, to),Scale(from, to, origin), andRotation(from, to, origin)tracks.
Scene transitions
Section titled “Scene transitions”FadeSceneTransitionandCircularRevealSceneTransitionare built-in scene effects.SceneTransitionAnchortags retained scene content and is obtained fromSceneTransitionHandle::Anchor().UseSceneTransition() -> SceneTransitionHandle;Runaccepts a fade or circular reveal, andRunAtsupplies the reveal origin.
Navigation and presentation motion structs reuse AnimationSpec but are declared in their owning headers.
Contract notes
Section titled “Contract notes”| Concern | Contract |
|---|---|
| Value ownership | Curves, specs, playback, and presentation modifiers are copyable values. MotionController retains mutable playback state. |
| Validation | Invalid Bézier control points, keyframe order, duration, spring parameters, or playback values throw std::invalid_argument at construction or start. |
| Frame time | Call Advance(FrameInfo) with runtime frame time; do not advance from a detached timer. |
| Reduced motion | Theme/runtime policy may resolve an animation to an immediate state. Application logic must not depend on intermediate frames. |
| Selection | Use Animated<T> for one presentation property, Transition for coordinated properties, and scene transitions for a rendered before/after snapshot. |

