Skip to content

Instantly share code, notes, and snippets.

@zsoltk
Last active January 26, 2020 16:17
Show Gist options
  • Save zsoltk/5b95202999523087ca02962889dd5d15 to your computer and use it in GitHub Desktop.
Save zsoltk/5b95202999523087ca02962889dd5d15 to your computer and use it in GitHub Desktop.
private val myFloatKey = FloatPropKey()
enum class MyState {
STATE_A, STATE_B
}
val definition = transitionDefinition {
state(STATE_A) {
this[myFloatKey] = 20f
}
state(STATE_B) {
this[myFloatKey] = 400f
}
}
@Composable
fun TransitionExample() {
Transition(definition = definition, initState = STATE_A, toState = STATE_B) {
val currentFloatValue = it[myFloatKey]
println("Transition: $currentFloatValue")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment