PageTransformer has "snapping" effect when animating elevation
<p>I have a <code>ViewPager</code> that is using a <code>PageTransformer</code>. I'm using the <code>PageTransformer</code> to animate the elevation of the cards inside my <code>ViewPager</code> whenever I scroll. Here is the code:</p>

<pre><code>mViewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
            @Override
            public void transformPage(View page, float position) {
                View card = ((ViewGroup)page).getChildAt(0);
                CardView cardView = (CardView) card;

                float absoluteValue = Math.abs(position);

                if (absoluteValue &lt; 1.3f) {
                    float scale = 1.3f - absoluteValue;
                    float scaleElevation = scale * 10f;
                    cardView.setCardElevation(scaleElevation);
                    //cardView.setElevation(scaleElevation);
                    Log.d(TAG, "scaleElevation: " + scaleElevation + ", position: " + position);

                }
            }
        });
</code></pre>

<p>Fairly straightforward. Now, what happens is, when you scroll, the elevation "animates" using the defined scale factor and the position in the scroll. But what happens, is when you finish scrolling to a new page, there's a sort of "snapping" effect with the shadows.</p>

<p>Here is a video that clearly shows the issue: <a href="https://gfycat.com/FlakyWarlikeEgg" rel="noreferrer">https://gfycat.com/FlakyWarlikeEgg</a></p>

<p>So what's happening here, and what would the fix be? </p>