Tolriq
09/22/2022, 8:51 AMAnimatedVisibility
? Clipping passed to the AnimatedVisibility
modifier is not working and the animation runs with a square .clip(CircleShape)
Oleksandr Balan
09/22/2022, 11:01 AMAnimatedVisibility
?Tolriq
09/22/2022, 11:03 AMDoris Liu
09/23/2022, 10:14 PMAnimatedVisibility
adds its clip and resizing modifier to the front of the modifiers that you pass into AnimatedVisibility. So clipping the content or adding .clip(CircleShape)
will behave the same, and neither will work as you expect.
Two potential solutions for your use case:
1) Add a Box/Surface to AnimatedVisibility as its parent, and clip the parent.
or 2) Clip the AnimatedVisibility but putting the responsibility to animate on the its child:
AnimatedVisibility(visible, modifier = Modifier.clip(CircleShape), enter = EnterTransition.None, exit = ExitTransition.None) {
yourContent(Modifier.animateEnterExit(enter = .../*enter transition here*/, exit = ..))
}
Doris Liu
09/26/2022, 5:49 PMAnimatedVisibility(
visible,
enter = EnterTransition.None, exit = ExitTransition.None
) {
YourContent(
Modifier
.wrapContentSize(Alignment.Center) // Add this
.clip(CircleShape) // and clip right before the animateEnterExit
.animateEnterExit()
.size(200.dp)
.background(Color.Red))
}
Tolriq
09/26/2022, 6:29 PMAnimatedVisibility(
visible = visible,
modifier = Modifier.fillMaxSize(),
enter = EnterTransition.None, exit = ExitTransition.None
) {
Box(
modifier = Modifier
.wrapContentSize(Alignment.Center)
.clip(CircleShape)
.animateEnterExit(
enter = fadeIn() + expandIn(expandFrom = Alignment.Center),
exit = shrinkOut(shrinkTowards = Alignment.Center) + fadeOut()
)
.size(300.dp)
.background(MaterialTheme.colors.background)
) {
Text(text = "AAA", modifier = Modifier.align(Alignment.Center))
}
}
So not tied to the horologist time picker 😞Doris Liu
09/26/2022, 6:53 PMDoris Liu
09/26/2022, 6:54 PMTolriq
09/26/2022, 7:09 PMTolriq
09/26/2022, 7:10 PM