Package-level declarations

Types

Link copied to clipboard
interface Animatable

Anything that advances over time, fed by an external clock. The library never opens its own thread/timer — a host app (e.g. Compose's withFrameNanos) is expected to call onTick on every frame, passing how many milliseconds elapsed since the last call.

Link copied to clipboard
class AnimatedProperty<T>(startValue: T, targetValue: T, spec: AnimationSpec, interpolate: (start: T, target: T, fraction: Float) -> T) : Animatable

A value that animates from startValue to targetValue over AnimationSpec.durationMs, following AnimationSpec.easing and AnimationSpec.repeatMode. interpolate is supplied by the caller because "what's halfway between two values" depends entirely on what T is (a plain number, a color, a position, ...) — this class only owns the timing/easing/repeat math, not the interpolation itself.

Link copied to clipboard

A registry of active Animatables. A host app calls tick once per frame (its own clock, not ours — see Animatable) and every registered animation advances together.

Link copied to clipboard
data class AnimationSpec(val durationMs: Long, val easing: Easing, val repeatMode: RepeatMode = RepeatMode.Once)

How an AnimatedProperty should play: how long, along what curve, and whether/how it repeats.

Link copied to clipboard
fun interface Easing

Reshapes an animation's linear progress into how it should actually feel. transform takes a linear fraction (0f at the start, 1f at the end) and returns the eased fraction actually used to compute the animated value — e.g. a constant-speed (linear) easing returns its input unchanged, while an "ease in" curve returns smaller values early on so the animation starts slow and speeds up.

Link copied to clipboard

What an AnimatedProperty does once it reaches the end of its duration.