This slides in the content of the transition, from a starting offset defined in [initialOffset] to IntOffset(0, 0).
SlideInOutSample
@Composable
fun SlideInOutSample() {
var visible by remember { mutableStateOf(true) }
AnimatedVisibility(
visible,
enter =
slideIn(tween(100, easing = LinearOutSlowInEasing)) { fullSize ->
// Specifies the starting offset of the slide-in to be 1/4 of the width to the
// right,
// 100 (pixels) below the content position, which results in a simultaneous slide up
// and slide left.
IntOffset(fullSize.width / 4, 100)
},
exit =
slideOut(tween(100, easing = FastOutSlowInEasing)) {
// The offset can be entirely independent of the size of the content. This specifies
// a target offset 180 pixels to the left of the content, and 50 pixels below. This
// will
// produce a slide-left combined with a slide-down.
IntOffset(-180, 50)
},
) {
// Content that needs to appear/disappear goes here:
Text("Content to appear/disappear", Modifier.fillMaxWidth().requiredHeight(200.dp))
}
}