Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.50 KB | None | 0 0
  1.  val animator:ValueAnimator = ValueAnimator.ofFloat(1.0f,0.0f)
  2.         animator.repeatCount = ValueAnimator.INFINITE
  3.         animator.interpolator = LinearInterpolator()
  4.         animator.duration = 7000L
  5.         animator.addUpdateListener {
  6.             val progress = it.animatedValue
  7.             val width = binding.bgView.width
  8.             val translationX = width.toFloat() * progress.toString().toFloat()
  9.             binding.bgView.translationX = translationX
  10.         }
  11.         animator.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement