https://kotlinlang.org logo
#compose
Title
# compose
b

bruno.aybar

10/01/2020, 4:34 AM
Hello, I've had issues with alpha when updating from
alpha02
to
alpha03
.
alpha02
: animate alpha for a button, works fine
alpha03
: animate alpha for a button, main content animates correctly, but a weird border animation occurs I made an small sample:
Copy code
@Composable
fun Alpha(modifier: Modifier) {
    val animation = animatedFloat(initVal = 1f)
    onActive {
        animation.animateTo(0f, anim = repeatable(
            iterations = Infinite,
            repeatMode = RepeatMode.Reverse,
            animation = tween(1000))
        )
    }
    Button(
        onClick = { ... },
        modifier = modifier.drawOpacity(animation.value)
    ) {
        Text("test")
    }
}

@Preview(showBackground = true)
@Composable
fun AlphaPreview() {
    Stack(Modifier.fillMaxSize()) {
        Alpha(Modifier.gravity(Alignment.Center))
    }
}
And this is how it looks if I use
alpha03
:
this is how it looks in
alpha02
:
z

Zach Klippenstein (he/him) [MOD]

10/01/2020, 4:35 AM
I noticed this with Scaffold and Crossfade too I think
4
b

bruno.aybar

10/01/2020, 4:38 AM
I wonder if it's related to the device. I'm able to replicate in most devices (phones with Android 10-11), but I'm not seeing this issue in my tablet (Galaxy Tab S3 w/ Android 8 )
z

Zach Klippenstein (he/him) [MOD]

10/01/2020, 4:43 AM
I saw it on an emulator running Android 10. Maybe an OS issue around rendering shadows?
k

Konyaco

10/01/2020, 4:44 AM
have the same issue
b

bruno.aybar

10/01/2020, 4:47 AM
How does it work for you folks if you run Interactive Preview? I've just run a quick test, and in my case, it is showing that shadow in both in
alpha02
and
alpha03
🤔
a

Andrey Kulikov

10/01/2020, 12:39 PM
Thanks for reporting! I filed a bug about it: https://issuetracker.google.com/issues/169835769
🙌 1
2 Views