Thread
#compose
    s

    Shivam Sethi

    1 year ago
    help composers, why this is not animating ? I put log statement which gets printed with the changing float values (1f to 1.5f)
    s

    Slava Glushenkov

    1 year ago
    Seems .scale(scale.value) will helps.
    s

    Shivam Sethi

    1 year ago
    Was my first approach, did not work
    Gabriele Mariotti

    Gabriele Mariotti

    1 year ago
    It doesn’t solve your issue but in this case you should use the lambda version to avoid recomposition
    .graphicsLayer { scaleX = scale.value; scaleX = scale.value }
    s

    Shivam Sethi

    1 year ago
    thanks for this tip
    b

    bmo

    1 year ago
    I think it's not animating because you don't give it content to animate :
    @Composable
    fun FrameBox(modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit) {
        val scale by rememberInfiniteTransition().animateFloat(
            initialValue = 1f,
            targetValue = 1.5f,
            animationSpec = infiniteRepeatable(
                animation = tween(1000, easing = LinearEasing),
                repeatMode = RepeatMode.Reverse
            )
        )
        
        Box(
            modifier
                .border(width = 2.dp, color = MaterialTheme.colors.secondary)
                .graphicsLayer {
                    scaleX = scale
                    scaleY = scale
                },
            content = content)
    }
    s

    Shivam Sethi

    1 year ago
    thanks, I will try this out.