Created
August 15, 2017 11:47
-
-
Save sagar-viradiya/bd51e9cb19a3b4631455b7ac49738057 to your computer and use it in GitHub Desktop.
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
val firstSpringAnimationX by lazy(LazyThreadSafetyMode.NONE) { | |
createSpringAnimation(android_bot1, DynamicAnimation.TRANSLATION_X) | |
} | |
val firstSpringAnimationY by lazy(LazyThreadSafetyMode.NONE) { | |
createSpringAnimation(android_bot1, DynamicAnimation.TRANSLATION_Y) | |
} | |
val secondSpringAnimationX by lazy(LazyThreadSafetyMode.NONE) { | |
createSpringAnimation(android_bot2, DynamicAnimation.TRANSLATION_X) | |
} | |
val secondSpringAnimationY by lazy(LazyThreadSafetyMode.NONE) { | |
createSpringAnimation(android_bot2, DynamicAnimation.TRANSLATION_Y) | |
} | |
private fun <K> createSpringAnimation(view: K, property: FloatPropertyCompat<K>) : SpringAnimation { | |
return SpringAnimation(view, property).setSpring(SpringForce()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment