Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

475
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda