Skip to content

Instantly share code, notes, and snippets.

@riggaroo
Created March 28, 2019 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riggaroo/e6aa6cedc420809da0eb84c142994eb1 to your computer and use it in GitHub Desktop.
Save riggaroo/e6aa6cedc420809da0eb84c142994eb1 to your computer and use it in GitHub Desktop.
Example using SpringAnimation to animate a custom view using FloatPropertyCompat properties.
private fun animateToPoint(point: Point) {
SpringAnimation(this, floatPropertyAnimX, point.x).apply {
spring.stiffness = SpringForce.STIFFNESS_MEDIUM
spring.dampingRatio = SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY
start()
}
SpringAnimation(this, floatPropertyAnimY, point.y).apply {
spring.stiffness = SpringForce.STIFFNESS_MEDIUM
spring.dampingRatio = SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY
start()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment