Package-level declarations

Types

Link copied to clipboard

Imperative wrapper around AnimatedValue.

Link copied to clipboard
class AnimatedContent<T>(targetState: T, transitionSpec: AnimatedContentTransitionScope<T>.() -> Unit = { enter = fadeIn() exit = fadeOut() }, contentKey: (T) -> Any? = { it }, contentPosition: ContentPosition = ContentPosition.TopStart, style: Style = Style, label: String = "AnimatedContent", content: ComponentScope.(T) -> Component?) : KComponent

A container that animates between content for different targetState values. The target content enters while previously-keyed content exits; both are kept in the container's own subtree (an overlapping StackLayout) until each exit settles — the same container-owned retention model as AnimatedVisibility. No DisappearingHost / rendercore machinery is involved.

Link copied to clipboard

Scope for AnimatedContent.transitionSpec. Exposes the initialState and targetState of the current transition (so the spec can vary by direction, e.g. via isTransitioningTo or slideIntoContainer) and collects the enter/exit specs that make up the ContentTransform.

Link copied to clipboard
class AnimatedValue<T> : Value<T>

A mutable, animation-aware value holder that implements Value for direct use in Litho Style APIs.

Link copied to clipboard
class AnimatedVisibility(visible: Boolean, enter: EnterTransition = fadeIn(), exit: ExitTransition = fadeOut(), style: Style = Style, label: String = "AnimatedVisibility", content: ComponentScope.() -> Component?) : KComponent

A container that animates its content entering and exiting the render tree.

Link copied to clipboard

Coalesces active FrameDrivenAnimations onto a shared AnimationFrameDriver.

Link copied to clipboard
data class AnimationFrameInvalidation(val stateId: StateId, val isLayoutState: Boolean, val attribution: String?)

A stable descriptor of an animated value's invalidation, recorded each frame the value changes.

Link copied to clipboard

The per-render handle returned by useAnimationGroup and the public surface for declaring a group's animations (animateFloat, animateDimen, …).

Link copied to clipboard

A handle that controls when an animation begins receiving frame callbacks.

Link copied to clipboard
interface AnimationSpec<T>

An immutable configuration that defines how an animation should behave.

Link copied to clipboard
sealed interface AnimationTrigger

Strategy interface that controls when an animation begins receiving frame callbacks.

Link copied to clipboard
sealed class AnimationVector

A small, mutable, fixed-size holder for the float components an animated value decomposes into — the currency the spring/tween machinery computes on. A scalar animates as one component, a size as two, a color as four.

Link copied to clipboard
interface Animator<out T>

A stateless, time-driven computation engine that produces animation values.

Link copied to clipboard

TypeConverter for Color values: 4 components (alpha, red, green, blue) blended independently, so two colors that would collide under a single-float projection still animate correctly.

Link copied to clipboard

Describes how an AnimatedContent transitions between two states: how the target content enters and how the outgoing content exits, plus an optional size animation.

Link copied to clipboard
class CubicBezierEasing(x1: Float, y1: Float, x2: Float, y2: Float) : Easing

An Easing defined by a cubic bezier curve.

Link copied to clipboard
value class DampingRatio(val value: Float)

Represents the damping ratio of a spring animation.

Link copied to clipboard
class DimenTypeConverter(resourceResolver: ResourceResolver) : TypeConverter<Dimen>

TypeConverter for Dimen values, animating in resolved pixels.

Link copied to clipboard

A FiniteAnimationSpec whose forward cycle has a known, fixed duration. Repeating a cycle is only possible when its length is known up front, so repeatable / infiniteRepeatable accept only duration-based specs (springs, which have no fixed cycle, are excluded).

Link copied to clipboard
fun interface Easing

Defines an easing curve that controls the rate of change of an animation over time.

Link copied to clipboard

The visibility lifecycle states for enter/exit transitions, shared by the animated container APIs.

Link copied to clipboard

Describes how content enters the render tree. Compose multiple effects with plus:

Link copied to clipboard

Describes how content exits the render tree. Compose multiple effects with plus:

Link copied to clipboard

An AnimationSpec that completes in finite time: it eventually reaches its target and settles.

Link copied to clipboard
Link copied to clipboard

The per-render handle returned by useInfiniteAnimationGroup and the public surface for declaring a container's loops (animateFloat, animateDimen, …).

Link copied to clipboard

An AnimationSpec that never settles — it loops for the lifetime of its owner. Produced by infiniteRepeatable and consumed by useInfiniteAnimation. Deliberately NOT a FiniteAnimationSpec, so the type system keeps it out of target-settling APIs that depend on completion.

Link copied to clipboard

TypeConverter for Int values. Rounds the component back to the nearest integer.

Link copied to clipboard

Handle returned by KeyframesBuilder.at to allow chaining using for per-segment easing.

Link copied to clipboard

Builder for defining keyframes in a KeyframesSpec.

Link copied to clipboard

Defines how an animation repeats when it reaches the end of an iteration.

Link copied to clipboard
data class Segment<S>(val initialState: S, val targetState: S)

Represents a directional transition segment from initialState to targetState.

Link copied to clipboard

Produces the AnimationSpec for an AnimatedContent container size animation between two content sizes. (Reserved for the opt-in, layout-affecting size-morph path.)

Link copied to clipboard

The direction content moves during a container-relative slide.

Link copied to clipboard

A one-time shift of a repeating animation's start time, used to stagger or delay loops (see repeatable / infiniteRepeatable).

Link copied to clipboard

How a StartOffset is applied relative to a repeating animation's first cycle.

Link copied to clipboard
value class Stiffness(val value: Float)

Represents the stiffness of a spring animation.

Link copied to clipboard

Defines the host properties animated by Style.transition.

Link copied to clipboard
fun interface Timing

Represents timing functions (easing curves) for animations.

Link copied to clipboard
data class TransformOrigin(val pivotFractionX: Float, val pivotFractionY: Float)

Describes the origin point for scale and clip transforms as fractional coordinates within the component's bounds.

Link copied to clipboard
interface TypeConverter<T>

Converts a value of type T to and from the AnimationVector the animation system runs on. Each animated type decomposes into a fixed set of float components — 1 for a scalar like Float, 2 for a size, 4 for a color — and the spring/tween machinery drives each component on its own, so a multi-component value carries a real per-component value and per-component velocity rather than being collapsed to one lossy scalar.

Functions

Link copied to clipboard

Sets the alpha of the View using a Value.

Link copied to clipboard

Wraps an Android Interpolator as an Easing.

Link copied to clipboard

Converts this Easing to an Android Interpolator.

Link copied to clipboard
fun Style.backgroundColor(backgroundColor: Value<Color>): Style

Sets the background color of the View using a Value.

Link copied to clipboard

Equivalent of Transition.SPRING_WITH_OVERSHOOT, the default Transition animator. Keeps the existing motion of code moving off Transition; prefer spring for new code.

fun <T> compatSpring(tension: Double, friction: Double): FiniteAnimationSpec<T>

Equivalent of Transition.springWithConfig(tension, friction). Keeps the existing motion of code moving off Transition; prefer spring for new code.

Link copied to clipboard

Equivalent of Transition.SPRING_WITHOUT_OVERSHOOT.

Link copied to clipboard

Equivalent of Transition.timing(durationMs), which eases with accelerate-decelerate. Keeps the existing motion of code moving off Transition; prefer tween for new code.

fun <T> compatTiming(durationMs: Int, interpolator: Interpolator?): DurationBasedAnimationSpec<T>

Equivalent of Transition.timing(durationMs, interpolator). A null interpolator is linear, as it is for Transition.

Link copied to clipboard

Sets the elevation of the View using a Value.

Link copied to clipboard
fun evaluateColor(fraction: Float, startColor: Color, endColor: Color): Color

Evaluates an intermediate Color between two colors, per channel. Kept as a standalone helper for call sites that blend colors directly.

Link copied to clipboard
fun expandHorizontally(spec: FiniteAnimationSpec<Float> = spring(), expandFrom: TransformOrigin = TransformOrigin.CenterStart): EnterTransition

Expands content horizontally by animating a clip rect from zero width to full width.

fun expandHorizontally(duration: Duration, expandFrom: TransformOrigin = TransformOrigin.CenterStart): EnterTransition

Expands content horizontally over duration — a shortcut for expandHorizontally(tween(duration), expandFrom).

Link copied to clipboard
fun expandIn(spec: FiniteAnimationSpec<Float> = spring(), expandFrom: TransformOrigin = TransformOrigin.TopStart): EnterTransition

Expands content in both directions by animating a clip rect from zero size to full size.

fun expandIn(duration: Duration, expandFrom: TransformOrigin = TransformOrigin.TopStart): EnterTransition

Expands content in both directions over duration — a shortcut for expandIn(tween(duration), expandFrom).

Link copied to clipboard
fun expandVertically(spec: FiniteAnimationSpec<Float> = spring(), expandFrom: TransformOrigin = TransformOrigin.TopCenter): EnterTransition

Expands content vertically by animating a clip rect from zero height to full height.

fun expandVertically(duration: Duration, expandFrom: TransformOrigin = TransformOrigin.TopCenter): EnterTransition

Expands content vertically over duration — a shortcut for expandVertically(tween(duration), expandFrom).

Link copied to clipboard
fun fadeIn(spec: FiniteAnimationSpec<Float> = spring(), initialAlpha: Float = 0.0f): EnterTransition

Fades content in from initialAlpha to fully opaque.

fun fadeIn(duration: Duration, initialAlpha: Float = 0.0f): EnterTransition

Fades content in over duration — a shortcut for fadeIn(tween(duration), initialAlpha).

Link copied to clipboard
fun fadeOut(spec: FiniteAnimationSpec<Float> = spring(), targetAlpha: Float = 0.0f): ExitTransition

Fades content out from fully opaque to targetAlpha.

fun fadeOut(duration: Duration, targetAlpha: Float = 0.0f): ExitTransition

Fades content out over duration — a shortcut for fadeOut(tween(duration), targetAlpha).

Link copied to clipboard

Sets a specific preferred height for this component using a Value.

Link copied to clipboard
fun <T> infiniteRepeatable(animation: DurationBasedAnimationSpec<T>, repeatMode: RepeatMode = RepeatMode.Restart, initialStartOffset: StartOffset = StartOffset(0)): InfiniteAnimationSpec<T>

Creates an InfiniteAnimationSpec that repeats animation for the lifetime of its owner. Because it never settles, it can only be consumed by useInfiniteAnimation, not by target-settling APIs.

Link copied to clipboard

Creates a KeyframesSpec with the given duration and keyframe definitions.

Link copied to clipboard
inline fun <T> Style.onBindViewWithValue(noinline name: () -> String, value: Value<T>, defaultValue: T, crossinline func: View.(T) -> Unit): Style

This Style adds a mount callback for state value.

Link copied to clipboard
fun <T> repeatable(iterations: Int, animation: DurationBasedAnimationSpec<T>, repeatMode: RepeatMode = RepeatMode.Restart, initialStartOffset: StartOffset = StartOffset(0)): FiniteAnimationSpec<T>

Creates a FiniteAnimationSpec that repeats animation for a fixed number of iterations.

Link copied to clipboard

Sets the rotation of the View using a Value.

Link copied to clipboard

Sets the X-axis rotation of the View using a Value.

Link copied to clipboard

Sets the Y-axis rotation of the View using a Value.

Link copied to clipboard

Sets the scale (scaleX and scaleY) of the View using a Value.

Link copied to clipboard
fun scaleIn(spec: FiniteAnimationSpec<Float> = spring(), initialScale: Float = 0.0f, transformOrigin: TransformOrigin = TransformOrigin.Center): EnterTransition

Scales content in from initialScale to full size.

fun scaleIn(duration: Duration, initialScale: Float = 0.0f, transformOrigin: TransformOrigin = TransformOrigin.Center): EnterTransition

Scales content in over duration — a shortcut for scaleIn(tween(duration), initialScale, transformOrigin).

Link copied to clipboard
fun scaleOut(spec: FiniteAnimationSpec<Float> = spring(), targetScale: Float = 0.0f, transformOrigin: TransformOrigin = TransformOrigin.Center): ExitTransition

Scales content out from full size to targetScale.

fun scaleOut(duration: Duration, targetScale: Float = 0.0f, transformOrigin: TransformOrigin = TransformOrigin.Center): ExitTransition

Scales content out over duration — a shortcut for scaleOut(tween(duration), targetScale, transformOrigin).

Link copied to clipboard
fun shrinkHorizontally(spec: FiniteAnimationSpec<Float> = spring(), shrinkTowards: TransformOrigin = TransformOrigin.CenterStart): ExitTransition

Shrinks content horizontally by animating a clip rect from full width to zero width.

fun shrinkHorizontally(duration: Duration, shrinkTowards: TransformOrigin = TransformOrigin.CenterStart): ExitTransition

Shrinks content horizontally over duration — a shortcut for shrinkHorizontally(tween(duration), shrinkTowards).

Link copied to clipboard
fun shrinkOut(spec: FiniteAnimationSpec<Float> = spring(), shrinkTowards: TransformOrigin = TransformOrigin.TopStart): ExitTransition

Shrinks content out in both directions by animating a clip rect from full size to zero size.

fun shrinkOut(duration: Duration, shrinkTowards: TransformOrigin = TransformOrigin.TopStart): ExitTransition

Shrinks content out in both directions over duration — a shortcut for shrinkOut(tween(duration), shrinkTowards).

Link copied to clipboard
fun shrinkVertically(spec: FiniteAnimationSpec<Float> = spring(), shrinkTowards: TransformOrigin = TransformOrigin.TopCenter): ExitTransition

Shrinks content vertically by animating a clip rect from full height to zero height.

fun shrinkVertically(duration: Duration, shrinkTowards: TransformOrigin = TransformOrigin.TopCenter): ExitTransition

Shrinks content vertically over duration — a shortcut for shrinkVertically(tween(duration), shrinkTowards).

Link copied to clipboard
fun slideInHorizontally(spec: FiniteAnimationSpec<Float> = spring(), initialOffsetX: (fullWidth: Int) -> Int = { -it }): EnterTransition

Slides content in horizontally. The initialOffsetX lambda receives the full width of the component and returns the pixel offset to start from.

fun slideInHorizontally(duration: Duration, initialOffsetX: (fullWidth: Int) -> Int = { -it }): EnterTransition

Slides content in horizontally over duration — a shortcut for slideInHorizontally(tween(duration), initialOffsetX).

Link copied to clipboard
fun <T> AnimatedContentTransitionScope<T>.slideIntoContainer(towards: SlideDirection, spec: FiniteAnimationSpec<Float> = spring(), initialOffset: (offsetForFullSlide: Int) -> Int = { it }): EnterTransition

Slides the target content into the container, entering from the edge opposite towards and moving in the towards direction to its resting position. Unlike slideInHorizontally / slideInVertically (which offset by the content's own size), the slide is measured across the container's bounds. Only meaningful inside AnimatedContent's transitionSpec.

fun <T> AnimatedContentTransitionScope<T>.slideIntoContainer(towards: SlideDirection, duration: Duration, initialOffset: (offsetForFullSlide: Int) -> Int = { it }): EnterTransition

Slides the target content into the container over duration — a shortcut for slideIntoContainer(towards, tween(duration), initialOffset).

Link copied to clipboard
fun slideInVertically(spec: FiniteAnimationSpec<Float> = spring(), initialOffsetY: (fullHeight: Int) -> Int = { -it }): EnterTransition

Slides content in vertically. The initialOffsetY lambda receives the full height of the component and returns the pixel offset to start from.

fun slideInVertically(duration: Duration, initialOffsetY: (fullHeight: Int) -> Int = { -it }): EnterTransition

Slides content in vertically over duration — a shortcut for slideInVertically(tween(duration), initialOffsetY).

Link copied to clipboard
fun slideOutHorizontally(spec: FiniteAnimationSpec<Float> = spring(), targetOffsetX: (fullWidth: Int) -> Int = { -it }): ExitTransition

Slides content out horizontally. The targetOffsetX lambda receives the full width of the component and returns the pixel offset to end at.

fun slideOutHorizontally(duration: Duration, targetOffsetX: (fullWidth: Int) -> Int = { -it }): ExitTransition

Slides content out horizontally over duration — a shortcut for slideOutHorizontally(tween(duration), targetOffsetX).

Link copied to clipboard
fun <T> AnimatedContentTransitionScope<T>.slideOutOfContainer(towards: SlideDirection, spec: FiniteAnimationSpec<Float> = spring(), targetOffset: (offsetForFullSlide: Int) -> Int = { it }): ExitTransition

Slides the outgoing content out of the container in the towards direction. The slide is measured across the container's bounds (see slideIntoContainer). Only meaningful inside AnimatedContent's transitionSpec.

fun <T> AnimatedContentTransitionScope<T>.slideOutOfContainer(towards: SlideDirection, duration: Duration, targetOffset: (offsetForFullSlide: Int) -> Int = { it }): ExitTransition

Slides the outgoing content out of the container over duration — a shortcut for slideOutOfContainer(towards, tween(duration), targetOffset).

Link copied to clipboard
fun slideOutVertically(spec: FiniteAnimationSpec<Float> = spring(), targetOffsetY: (fullHeight: Int) -> Int = { -it }): ExitTransition

Slides content out vertically. The targetOffsetY lambda receives the full height of the component and returns the pixel offset to end at.

fun slideOutVertically(duration: Duration, targetOffsetY: (fullHeight: Int) -> Int = { -it }): ExitTransition

Slides content out vertically over duration — a shortcut for slideOutVertically(tween(duration), targetOffsetY).

Link copied to clipboard

Creates a SnapSpec that instantly jumps to the target value.

Link copied to clipboard
fun <T> spring(stiffness: Stiffness = Stiffness.Medium, dampingRatio: DampingRatio = DampingRatio.NoBouncy): FiniteAnimationSpec<T>

Creates a SpringSpec for physics-based spring animations.

Link copied to clipboard
Link copied to clipboard

Adds a diff-based transition to the host represented by this Style.

Link copied to clipboard

Sets the X-axis translation of the View using a Value.

Link copied to clipboard

Sets the Y-axis translation of the View using a Value.

Link copied to clipboard
fun <T> tween(duration: Duration = 300.ms, easing: Easing = Easing.FastOutSlowIn, delay: Duration = ZERO): DurationBasedAnimationSpec<T>

Creates a TweenSpec for time-based animations with an easing curve.

Link copied to clipboard
fun <T> ComponentScope.useAnimatable(initialValue: T, typeConverter: TypeConverter<T>, label: String = ""): Animatable<T>

Creates an Animatable for imperative animation control.

Link copied to clipboard
fun ComponentScope.useAnimatedColor(targetValue: Color, spec: FiniteAnimationSpec<Color> = spring(), trigger: AnimationTrigger = AnimationTrigger.Immediate, label: String = "color"): Value<Color>

Animates a Color value with per-channel interpolation, automatically starting a new animation whenever targetValue changes.

Link copied to clipboard
fun ComponentScope.useAnimatedDimen(targetValue: Dimen, spec: FiniteAnimationSpec<Dimen> = spring(), trigger: AnimationTrigger = AnimationTrigger.Immediate, label: String = "dimen"): Value<Dimen>

Animates a Dimen value, automatically starting a new animation whenever targetValue changes.

Link copied to clipboard
fun ComponentScope.useAnimatedFloat(targetValue: Float, spec: FiniteAnimationSpec<Float> = spring(), trigger: AnimationTrigger = AnimationTrigger.Immediate, label: String = "float"): Value<Float>

Animates a Float value, automatically starting a new animation whenever targetValue changes.

Link copied to clipboard
fun ComponentScope.useAnimatedInt(targetValue: Int, spec: FiniteAnimationSpec<Int> = spring(), trigger: AnimationTrigger = AnimationTrigger.Immediate, label: String = "int"): Value<Int>

Animates an Int value, automatically starting a new animation whenever targetValue changes.

Link copied to clipboard
fun <T> ComponentScope.useAnimatedValue(targetValue: T, typeConverter: TypeConverter<T>, spec: FiniteAnimationSpec<T> = spring(), trigger: AnimationTrigger = AnimationTrigger.Immediate, label: String = ""): Value<T>

Animates a value of type T, automatically starting a new animation whenever targetValue changes.

Link copied to clipboard
fun <S> ComponentScope.useAnimationGroup(targetState: S, trigger: AnimationTrigger = AnimationTrigger.Immediate, label: String = "transition"): AnimationGroup<S>

Coordinates multiple animated properties that respond to a shared targetState.

Link copied to clipboard

Creates an InfiniteAnimationGroup container for continuous, lifecycle-owned looping animations — shimmer, pulse, spinners, breathing effects, loading dots. Each child loops between an explicit from and to, starts with the component, and stops when it unmounts.

Link copied to clipboard

Returns a stable AnimationTrigger.Lazy instance for explicit manual triggering.

Link copied to clipboard

Sets a specific preferred width for this component using a Value.