Skip to content

Instantly share code, notes, and snippets.

View AshuTyagi16's full-sized avatar

Ashu Tyagi AshuTyagi16

View GitHub Profile
companion object {
/** The magnitude of rotation while the list is scrolled. */
private const val SCROLL_ROTATION_MAGNITUDE = 0.25f
/** The magnitude of rotation while the list is over-scrolled. */
private const val OVERSCROLL_ROTATION_MAGNITUDE = -10
/** The magnitude of translation distance while the list is over-scrolled. */
private const val OVERSCROLL_TRANSLATION_MAGNITUDE = 0.2f
var currentVelocity = 0f
/**
* A [SpringAnimation] for this RecyclerView item. This animation rotates the view with a bouncy
* spring configuration, resulting in the oscillation effect.
*
* The animation is started in [Recyclerview.onScrollListener].
*/
val rotation: SpringAnimation = SpringAnimation(itemView, SpringAnimation.ROTATION)
.setSpring(