| package com.airbnb.lottie.issues.compose |
| |
| import android.os.Bundle |
| import androidx.activity.compose.setContent |
| import androidx.appcompat.app.AppCompatActivity |
| import androidx.compose.runtime.Composable |
| import androidx.compose.runtime.getValue |
| import com.airbnb.lottie.compose.LottieAnimation |
| import com.airbnb.lottie.compose.LottieCompositionSpec |
| import com.airbnb.lottie.compose.LottieConstants |
| import com.airbnb.lottie.compose.animateLottieCompositionAsState |
| import com.airbnb.lottie.compose.rememberLottieComposition |
| |
| class ComposeIssueReproActivity : AppCompatActivity() { |
| override fun onCreate(savedInstanceState: Bundle?) { |
| super.onCreate(savedInstanceState) |
| setContent { |
| Content() |
| } |
| } |
| |
| @Composable |
| fun Content() { |
| val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.color)) |
| val progress by animateLottieCompositionAsState(composition, iterations = LottieConstants.IterateForever) |
| LottieAnimation(composition, { progress }) |
| } |
| } |