@Override
    public void draw(final Canvas canvas) {
        final Rect bounds = getBounds();
        if (!isVisible() || bounds.isEmpty()) {
            return;
        }

        final Drawable inner = getSideShown() /* == front */ ? mFront : mBack;

        final float totalDurationMs = mPreFlipDurationMs + mFlipDurationMs + mPostFlipDurationMs;

        final float scaleX;
        if (mFlipFraction / 2 <= mPreFlipDurationMs / totalDurationMs) {
            // During pre-flip.
            scaleX = 1;
        } else if (mFlipFraction / 2 >= (totalDurationMs - mPostFlipDurationMs) / totalDurationMs) {
            // During post-flip.
            scaleX = 1;
        } else {
            // During flip.
            final float flipFraction = mFlipFraction / 2;
            final float flipMiddle = (mPreFlipDurationMs / totalDurationMs
                    + (totalDurationMs - mPostFlipDurationMs) / totalDurationMs) / 2;
            final float distFraction = Math.abs(flipFraction - flipMiddle);
            final float multiplier = 1 / (flipMiddle - (mPreFlipDurationMs / totalDurationMs));
            scaleX = distFraction * multiplier;
        }

        canvas.save();
        // The flip is a simple 1 dimensional scale.
        canvas.scale(scaleX, 1, bounds.exactCenterX(), bounds.exactCenterY());
        inner.draw(canvas);
        canvas.restore();
    }
Create a new FlipDrawable. The front is fully shown by default.
<p>
<p/>
The 3 durations are: (best viewed in documentation form)
<pre>
&lt;pre&gt;[_][]|[][_]&lt;post&gt;
  |       |       |
  V       V       V
&lt;pre>&lt;   flip  &gt;&lt;post&gt;
</pre>

@param front              The front drawable.
@param back               The back drawable.
@param flipDurationMs     The duration of the actual flip. This duration includes both
                          animating away one side and showing the other.
@param preFlipDurationMs  The duration before the actual flip begins. Subclasses can use this
                          to add flourish.
@param postFlipDurationMs The duration after the actual flip begins. Subclasses can use this
                          to add flourish.
android/modules/module_common/src/main/java/github/tornaco/android/thanos/widget/checkable/FlipDrawable.java