Hey guys :wave: Can someone help me how to make an...
# compose
n
Hey guys đź‘‹ Can someone help me how to make an alpha animation that goes from left to right? Making it look like a shimmer effect? The reason being I have a static image as a placeholder that I wish to create a shimmering effect on but without the normal greyed out part? I have done something like this but this animates the alpha of the whole image, while what I want is for it to move from left to right and repeat (exactly like a normal shimmering effect).
Copy code
val infiniteTransition = rememberInfiniteTransition(label = "")
                    val skeletonAlpha by infiniteTransition.animateFloat(
                        initialValue = 1f,
                        targetValue = 0.1f,
                        animationSpec = infiniteRepeatable(
                            animation = tween(300, easing = LinearEasing),
                            repeatMode = RepeatMode.Reverse
                        ), label = ""
                    )
                        Image(
                            modifier = Modifier
                                .padding(start = 16.dp, end = 16.dp, top = 24.dp)
                                .height(186.dp)
                                .alpha(skeletonAlpha),
                            painter = painterResource(id = R.drawable.image),
                            alignment = Alignment.Center,
                            contentDescription = null,
                            contentScale = ContentScale.FillWidth,
                        )
k
n
@Kirill Grouchnikov Thanks but that seems to be with the grey background which I don’t want.
Oh wait I didn’t look all the way to the bottom. Thanks!
k
Even if it doesn’t do exactly what you need, you can look at the source code