sprockets/src/main/java/net/sf/sprockets/view/Animators.java
public static ViewPropertyAnimator makeScaleDownAnimation(Activity a, Rect to) {
        View view = a.getWindow().getDecorView();
        Rect frame = Windows.getFrame(a);
        float sx = (float) to.width() / view.getWidth();
        float sy = (float) to.height() / (view.getHeight() - frame.top); // ignore status bar
        view.setPivotX(0.0f);
        view.setPivotY(0.0f);
        return view.animate().translationX(to.left).translationY(to.top - frame.top * sy).scaleX(sx)
                .scaleY(sy).withLayer();
    }
public static ViewPropertyAnimator makeScaleDownAnimation(Activity a, Rect to) {
        View view = a.getWindow().getDecorView();
        Rect frame = Windows.getFrame(a);
        float sx = (float) to.width() / view.getWidth();
        float sy = (float) to.height() / (view.getHeight() - frame.top); // ignore status bar
        view.setPivotX(0.0f);
        view.setPivotY(0.0f);
        return view.animate().translationX(to.left).translationY(to.top - frame.top * sy).scaleX(sx)
                .scaleY(sy).withLayer();
    }
Scale the Activity down to the rectangle. To see the Activity behind this one, you must
include the below attributes[1] in your Activity theme. You may further modify the animator,
for example to fade out the Activity by decreasing its
{@link ViewPropertyAnimator#alpha(float) alpha} and/or set an
{@link ViewPropertyAnimator#withEndAction(Runnable) end action} that finishes the Activity.
When finishing the Activity in this way, you may wish to also call
{@link Activity#overridePendingTransition(int, int) Activity.overridePendingTransition(0,
0)} in order to prevent the system Activity close animation from running.
<p>
1. Activity theme attributes
</p>
{@code <item name="android:windowBackground">@android:color/transparent</item>}<br/>
{@code <item name="android:windowIsTranslucent">true</item>}

@see ActivityOptions#makeScaleUpAnimation(View, int, int, int, int)