Created
August 15, 2017 09:31
-
-
Save sagar-viradiya/cf1f183f01b2ea237f2bb1e4579a0951 to your computer and use it in GitHub Desktop.
Creating SpringAnimation and attaching SpringForce
This file contains 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 springForce: SpringForce by lazy(LazyThreadSafetyMode.NONE) { | |
SpringForce(0f).apply { | |
stiffness = SpringForce.STIFFNESS_MEDIUM | |
dampingRatio = SpringForce.DAMPING_RATIO_HIGH_BOUNCY | |
} | |
} | |
private val springAnimationTranslationX: SpringAnimation by lazy(LazyThreadSafetyMode.NONE) { | |
SpringAnimation(android_bot, DynamicAnimation.TRANSLATION_X).setSpring(springForce) | |
} | |
private val springAnimationTranslationY: SpringAnimation by lazy(LazyThreadSafetyMode.NONE) { | |
SpringAnimation(android_bot, DynamicAnimation.TRANSLATION_Y).setSpring(springForce) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment