Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

466
Views
Jetpack Compose: reproduzca animaciones complejas en el cambio de estado

¿Cómo reproduzco una animación compleja usando coroutine al cambiar a un estado particular?

 @Composable fun SomeView(viewModel: SomeViewModel) { val state by viewModel.stateFlow.collectAsState() val scope = rememberCoroutineScope() ... val shutterAlpha by remember { mutableStateOf(0f) } Box(modifier = Modifier .fillMaxSize() .alpha(shutterAlpha) .background(Color.Black) ) val transition = updateTransition(targetState = state, label = "label") <on transitioning to CaptureState> { // need actual condition check code here scope.launch { animate(0f, 1f, animationSpec = tween(150)) { value, _ -> shutterAlpha = value } animate(1f, 0f, animationSpec = tween(150)) { value, _ -> shutterAlpha = value } } } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

LaunchedEffect es la respuesta:

 @Composable fun SomeView(viewModel: SomeViewModel) { val state by viewModel.stateFlow.collectAsState() ... val shutterAlpha by remember { mutableStateOf(0f) } Box(modifier = Modifier .fillMaxSize() .alpha(shutterAlpha) .background(Color.Black) ) LaunchedEffect(state) { if (state == CaptureState) { animate(0f, 1f, animationSpec = tween(150)) { value, _ -> shutterAlpha = value } animate(1f, 0f, animationSpec = tween(150)) { value, _ -> shutterAlpha = value } } } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!