Applies an animated marquee effect to the modified content if it's too wide to fit in the available space.
BasicMarqueeSample
@Preview(showBackground = true)
@Sampled
@Composable
fun BasicMarqueeSample() {
// Marquee only animates when the content doesn't fit in the max width.
Column(Modifier.width(30.dp)) { Text("hello world", Modifier.basicMarquee()) }
}
BasicMarqueeWithFadedEdgesSample
@Preview(showBackground = true)
@Sampled
@Composable
fun BasicMarqueeWithFadedEdgesSample() {
val edgeWidth = 32.dp
BasicFocusableMarqueeSample
@Preview(showBackground = true)
@Sampled
@Composable
fun BasicFocusableMarqueeSample() {
val focusRequester = remember { FocusRequester() }
// Marquee only animates when the content doesn't fit in the max width.
Column(Modifier.width(30.dp)) {
Text(
"hello world",
Modifier.clickable { focusRequester.requestFocus() }
.basicMarquee(animationMode = MarqueeAnimationMode.WhileFocused)
.focusRequester(focusRequester)
.focusable(),
)
}
}