Animation blinks when quickly swiping
davidvavra opened this issue · 1 comments
Hi, we are using your library for changing color of tabs while swiping. The color blinks in the middle, I have recorded a video.
If you play this video frame by frame, it's visible: First the color changes from black to green slowly. Then in the middle it changes for a little while to full green and then it goes back to the animation.
Any suggestions? Do you need to know more about our implementation?
Bit late to the party, but I just ran into the same issue and found that it's caused by the onPageSelected()
callback in ViewPagerAnimator
:
@Override
public void onPageSelected(int position) {
V value = provider.get(position);
property.set(value);
}
The line that says property.set(value)
pushes the 'next' page position as value into the Property
mid-interpolation. As a result, you basically receive the 'end' value of the interpolated sequence somewhere halfway through the scroll.
@davidvavra In your case you're interpolating between black and green. The sudden flash of green is the result of the page position (end value, green) being set, after which the interpolation values continue again.
I haven't had a chance yet to look into a solution/workaround for this, but I suspect onPageSelected()
should take the scroll state into account when deciding to propagate the position to the property or not.