Konyaco
03/13/2021, 3:19 AMkeys.mapTo(items) { key ->
CrossfadeAnimationItem(key) {
val alpha by transition.animateFloat(
transitionSpec = { animationSpec }
) { if (it == key) 1f else 0f }
// NOTICE
Box(Modifier.alpha(alpha = alpha)) {
content(key)
}
}
}
And if it is not animating, it uses:
Box(modifier) {
items.fastForEach {
key(it.key) {
it.content()
}
}
}
The problem is, Modifier.alpha()
is an alias of graphicsLayer(alpha = alpha, clip = true)
,
If you are holding a Button, Card or anything with shadow, Crossfade will clip the shadow when animation starts, and resume when animation finishes, that will be very unnatural.
And I wonder the reason that Modifier.alpha()
sets clip
property to true, is that really necessary?Doris Liu
03/13/2021, 3:57 AMCrossfade
. Could you file a bug on that?
@Nader Jawad on the question regarding Modifier.alpha
clipping by default.Konyaco
03/13/2021, 4:18 AMNader Jawad
03/13/2021, 4:38 AMNader Jawad
03/13/2021, 4:39 AMNader Jawad
03/13/2021, 4:39 AMNader Jawad
03/13/2021, 4:40 AM