conference-app-2021 icon indicating copy to clipboard operation
conference-app-2021 copied to clipboard

Add animation preview of LandingScreen

Open takahirom opened this issue 3 years ago • 2 comments

Kind (Required)

  • Improvement

Overview (Required)

  • Add a Preview for animtion and check it out in the animation preview.

Links

  • https://developer.android.com/jetpack/compose/tooling#animations

takahirom avatar Mar 09 '21 00:03 takahirom

I am wondering if this feature available now🤔 I tried something like below according the document you provided.

@Preview(showBackground = true)
@Composable
fun PreviewLandingScreen() {
    ConferenceAppFeederTheme(false) {
        val (disappeared, onDisappear) = remember {
            mutableStateOf(false)
        }
        val transition = updateTransition(disappeared)
        val splashAlpha by transition.animateFloat { state ->
            if (state) 0f else 1f
        }

        LandingScreen(
            modifier = Modifier
                .toggleable(value = disappeared, onValueChange = onDisappear)
                .alpha(splashAlpha),
        ){}
    }
}

But the animation inspector button was disabled with a message–"No animations available for inspection".

This is my first time trying Jetpack Compose, and I may doing something wrong. So it is not necessary to teach me the right way if there is something wrong. I will learn from the PR closed this issue.

myihsan avatar Mar 09 '21 14:03 myihsan

I'll check it later

takahirom avatar Mar 10 '21 01:03 takahirom