Question Details

No question body available.

Tags

android animation android-jetpack-compose android-animation

Answers (1)

June 20, 2026 Score: 1 Rep: 50,479 Quality: Medium Completeness: 80%

I would split this animation into two phases, 1: on start a constant acceleration, 2: spin at constant speed forever. See below:

val rotation = remember { Animatable(masterAngle) }
// Do animation in coroutine
LaunchedEffect(Unit) {
    // 1) start at constant acceleration for 3s
    rotation.animateTo(
        targetValue = masterAngle + 180f,
        animationSpec = tween(durationMillis = 3000, easing = Easing { x -> x * x })
    )
    // 2) then spin at constant speed, forever
    while (isActive) {
        rotation.animateTo(
            targetValue = rotation.value + 360f,
            animationSpec = tween(durationMillis = 3000, easing = LinearEasing)
        )
    }
}
val baseRotation = rotation.value

You can find docs on this in : https://developer.android.com/develop/ui/compose/animation/value-based#low-level-apis and https://developer.android.com/develop/ui/compose/animation/value-based#animatable.