Last active
January 26, 2020 16:17
-
-
Save zsoltk/5b95202999523087ca02962889dd5d15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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