Interface

AnimatedContentTransitionScope

AnimatedContentTransitionScope provides functions that are convenient and only applicable in the context of AnimatedContent, such as slideIntoContainer and slideOutOfContainer.

Source set: Common
public sealed interface AnimatedContentTransitionScope<S> : Transition.Segment<S>

AnimatedContentTransitionScope provides functions that are convenient and only applicable in the context of AnimatedContent, such as slideIntoContainer and slideOutOfContainer.

Properties

KeepUntilTransitionsFinished

Source set: Common
public val ExitTransition.Companion.KeepUntilTransitionsFinished: ExitTransition

KeepUntilTransitionsFinished defers the disposal of the exiting content till both enter and exit transitions have finished. It can be combined with other ExitTransitions using +.

Important: KeepUntilTransitionsFinished works the best when the zIndex for the incoming and outgoing content are specified. Otherwise, if the content gets interrupted from entering and switching to exiting using KeepUntilTransitionsFinished, the holding pattern may render exiting content on top of the entering content, unless the z-order is specified.

contentAlignment

Source set: Common
public val contentAlignment: Alignment

This returns the Alignment specified on AnimatedContent.

Functions

using

public infix fun ContentTransform.using(sizeTransform: SizeTransform?): ContentTransform

Customizes the SizeTransform of a given ContentTransform. For example:

slideIntoContainer

public fun slideIntoContainer(
        towards: SlideDirection,
        animationSpec: FiniteAnimationSpec<IntOffset> =
            spring(visibilityThreshold = IntOffset.VisibilityThreshold),
        initialOffset: (offsetForFullSlide: Int) -> Int = { it },
    ): EnterTransition

This defines a horizontal/vertical slide-in that is specific to AnimatedContent from the edge of the container. The offset amount is dynamically calculated based on the current size of the AnimatedContent and its content alignment. This offset (may be positive or negative based on the direction of the slide) is then passed to initialOffset. By default, initialOffset will be using the offset calculated from the system to slide the content in. slideIntoContainer is a convenient alternative to slideInHorizontally and slideInVertically when the incoming and outgoing content differ in size. Otherwise, it would be equivalent to slideInHorizontally and slideInVertically with an offset of the full width/height.

towards specifies the slide direction. Content can be slided into the container towards SlideDirection.Left, SlideDirection.Right, SlideDirection.Up and SlideDirection.Down.

animationSpec defines the animation that will be used to animate the slide-in.

slideOutOfContainer

public fun slideOutOfContainer(
        towards: SlideDirection,
        animationSpec: FiniteAnimationSpec<IntOffset> =
            spring(visibilityThreshold = IntOffset.VisibilityThreshold),
        targetOffset: (offsetForFullSlide: Int) -> Int = { it },
    ): ExitTransition

This defines a horizontal/vertical exit transition to completely slide out of the AnimatedContent container. The offset amount is dynamically calculated based on the current size of the AnimatedContent and the new target size. This offset gets passed to targetOffset lambda. By default, targetOffset uses this offset as is, but it can be customized to slide a distance based on the offset. slideOutOfContainer is a convenient alternative to slideOutHorizontally and slideOutVertically when the incoming and outgoing content differ in size. Otherwise, it would be equivalent to slideOutHorizontally and slideOutVertically with an offset of the full width/height.

towards specifies the slide direction. Content can be slided out of the container towards SlideDirection.Left, SlideDirection.Right, SlideDirection.Up and SlideDirection.Down.

animationSpec defines the animation that will be used to animate the slide-out.

Last updated: