Could you tell me why it stops working when I use val animateAngle: Float by transition.animateFloat instead of val animateAngle by animateFloatAsState?
It seems that the variable rotated is not updated when the button is clicked.
    var rotated by remember {
        mutableStateOf(false)
    }
    val transition = updateTransition(
        targetState = rotated,
        label = "Rotate"
    )
        val animateAngle: Float by transition.animateFloat(
            transitionSpec = {
                tween(2000)
            },
            label = "Rotate box"
        ) { state ->
            when(state){
                rotated -> 360f
                else -> 0f
            }
        }
        Column (
        ) {
            Image(
                painter = painterResource(id = R.drawable.propeller),
                contentDescription = "fan",
                modifier = Modifier
                    .rotate(animateAngle)
                    .padding(30.dp)
                    .size(100.dp))
            Button(
                onClick = {
                    rotated = !rotated
                },
            ) {
                Text(text = "Rotate Box")
            }
        }