title: Align Android Lottie animation to scrolling
body: <p>I want to align my Lottie animation progress with the scrolling of a RecyclerView or ViewPager. However Lottie seems to only show the &quot;real&quot; Frames and doesn't interpolate between them. When normally playing the animation this doesn't happen and Lottie interpolates between Frames. If I scroll really slowly I can see that my RecyclerView scrolls but Lottie doesn't update frames. Here is what I currently do:</p>
  <pre><code>recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
  
      override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
          super.onScrolled(recyclerView, dx, dy)
  
          val offset = recyclerView.computeHorizontalScrollOffset()
          val extent = recyclerView.computeHorizontalScrollExtent()
          val range = recyclerView.computeHorizontalScrollRange()
  
          val percentage = offset.toFloat() / (range.toFloat() - extent.toFloat())
  
          lottieAnimationView.progress = percentage
      }
  }
  </code></pre>
  <p>The same problem occurs when I try to update the progress within a ValueAnimator, e.g.:</p>
  <pre><code>val valueAnimator = ValueAnimator.ofFloat(0f, 1f)
  valueAnimator.duration = 30000
  valueAnimator.addUpdateListener { animation -&gt;
      lottieAnimationView.progress = animation.animatedFraction
  }
  valueAnimator.start()
  </code></pre>
  <p>I'm not sure if I miss something or this isn't supported by Lottie. It seems to work with iOS though.</p>
  <p>Here is a sample video of my problem. The top animation is just done via <code>playAnimation</code>, the lower one is done via <code>valueAnimator</code> and <code>setProgress</code>:</p>
  <p><a href="https://i.stack.imgur.com/rhq0C.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rhq0C.gif" alt="Broken Lottie Animation" /></a></p>
  <p>I am using Lottie 2.7.0, but I tried using older versions like 2.6.x as well. I tried on the latest beta version, Lottie 3.0.0-beta4, as well, but had the same issue there, too.</p>
  <p>The app is not migrated to AndroidX yet.</p>