ContentTransform

class ContentTransform(val targetContentEnter: EnterTransition, val initialContentExit: ExitTransition, targetContentZIndex: Float = 0.0f, sizeTransform: SizeTransform? = SizeTransform())

How one content of an AnimatedContent replaces another: the target content's enter, the initial content's exit, their paint order, and how the container's size animates.

togetherWith builds one from an EnterTransition and an ExitTransition, and AnimatedContentTransitionScope.using replaces its sizeTransform:

AnimatedContent(
targetState = page,
transitionSpec = { fadeIn() togetherWith fadeOut() using null },
) { Page(it) }

Parameters

targetContentZIndex

the paint order of the target content; 0f by default.

sizeTransform

how the container's size animates, or null for a container that takes the room both contents need and animates nothing. SizeTransform() by default.

Constructors

Link copied to clipboard
constructor(targetContentEnter: EnterTransition, initialContentExit: ExitTransition, targetContentZIndex: Float = 0.0f, sizeTransform: SizeTransform? = SizeTransform())

Properties

Link copied to clipboard

how the content of the state being left disappears.

Link copied to clipboard

How the container's size animates, or null for a container that takes the room its content needs. Set with AnimatedContentTransitionScope.using.

Link copied to clipboard

how the content of the target state appears.

Link copied to clipboard

The paint order of the target content. Content with a higher value paints over content with a lower one; equal values keep composition order, which leaves the target content on top.