Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02c7432e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow pausing touchpad tutorial animations on tap before gesture...

Merge "Allow pausing touchpad tutorial animations on tap before gesture tracking has started." into main
parents 2369804a 5f2149af
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -23,13 +23,16 @@ import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.node.Ref
@@ -93,13 +96,19 @@ private fun EducationAnimation(
    animationProperties: LottieDynamicProperties,
) {
    val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(educationAnimationId))
    var isPlaying by remember { mutableStateOf(true) }
    val progress by
        animateLottieCompositionAsState(composition, iterations = LottieConstants.IterateForever)
        animateLottieCompositionAsState(
            composition,
            iterations = LottieConstants.IterateForever,
            isPlaying = isPlaying,
            restartOnPlay = false,
        )
    LottieAnimation(
        composition = composition,
        progress = { progress },
        dynamicProperties = animationProperties,
        modifier = Modifier.fillMaxSize(),
        modifier = Modifier.fillMaxSize().clickable { isPlaying = !isPlaying },
    )
}