flux/flux library
Flux: Spring animations with velocity handoff.
Ported from Fuchsia's Mondrian story shell animation system, copied into
libmonet from telosnex's features/flux port so AnimatedMonetTheme can
use MovingTargetAnimation instead of a fixed-duration
AnimationController.
Note: the Flutter Hooks integration (useFluxSpring/useFluxManual) is
intentionally not copied here, since libmonet does not depend on
flutter_hooks. Use the FluxAnimation/SimAnimationController/
MovingTargetAnimation classes directly, as AnimatedMonetTheme does.
Classes
-
ChainedAnimation<
T> - A FluxAnimation that chains animations in succession.
-
FluxAnimation<
T> - An Animation<T> that carries an intrinsic velocity.
- FluxCurve
- A Curve backed by a spring simulation.
- FluxSpring
- Named spring presets from Fuchsia's Armadillo shell.
- Independent2DSim
- 2D Sim where each axis is independent of the other.
- IndependentRectSim
- Rect Sim with independent size and position simulators.
-
ManualAnimation<
T> - A manually controllable FluxAnimation.
-
MovingTargetAnimation<
T> - Animation that chases a moving target using a Simulate function.
- RK4Spring
- A spring simulation using 4th-order Runge-Kutta numerical integration.
- RK4SpringDescription
- Spring parameters for the RK4 simulation.
- RK4SpringSim
- Wraps RK4Spring as a Sim<double> for use with SimAnimationController.
-
Sim<
T> - The base class for all generic immutable simulations.
-
SimAnimationController<
T> - A FluxAnimation driven by a Sim.
- SimDouble
- Convenience wrapper for Flutter's Simulation (which is double-only).
- StaticSimulation
- A Simulation that never changes its value.
-
TransformedAnimation<
T> - A transformation wrapper for an animation.
Functions
-
rk4SpringSim(
{required double start, required double end, double velocity = 0.0, RK4SpringDescription desc = const RK4SpringDescription()}) → RK4SpringSim - Create an RK4SpringSim from start → end.
-
springSimDouble(
{required double start, required double end, double velocity = 0.0, SpringDescription spring = FluxSpring.snappy}) → SimDouble - Create a SimDouble spring from start → end with initial velocity.
-
springSimulateDouble(
{SpringDescription spring = FluxSpring.snappy}) → Simulate< double> - A Simulate function for doubles. Use with MovingTargetAnimation.
Typedefs
-
FluxAnimationInit<
T> = FluxAnimation< T> Function(T value, T velocity) - A function that creates a FluxAnimation from an initial value and velocity.
-
FluxTransform<
T> = T Function(T value) - A generic transform function from one value to another of the same type.
-
Simulate<
T> = Sim< T> Function(T start, T end, T velocity) - Generates a Sim with given params.