Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of using FloatPropertyCompat for SpringAnimations.
private val floatPropertyAnimX = object : FloatPropertyCompat<ColorDropperView>(PROPERTY_X) {
override fun setValue(dropper: ColorDropperView?, value: Float) {
dropper?.setDropperX(value)
}
override fun getValue(dropper: ColorDropperView?): Float {
return dropper?.getDropperX() ?: 0f
}
}
private val floatPropertyAnimY = object : FloatPropertyCompat<ColorDropperView>(PROPERTY_Y) {
override fun setValue(dropper: ColorDropperView?, value: Float) {
dropper?.setDropperY(value)
}
override fun getValue(dropper: ColorDropperView?): Float {
return dropper?.getDropperY() ?: 0f
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment