I have few buttons/images there. on clicking I would like such animation :
(image opens like )book cover opens, and related activity/fragment opens with ease in animation and gets full screen.
Any thoughts ?
Something similar happening in cook app iOS, Link of cook app : https://itunes.apple.com/us/app/cook/id687560846?mt=8
P.S : I have added animation, gif will run uninterrupted once completely loaded.

ObjectAnimator is a subclass of ValueAnimator. Main difference is that in case of ValueAnimator you have to override onAnimationUpdate(...) method where you will specify where to apply animated value: ValueAnimator animator = ValueAnimator.
You can implement this animation using standard android animator with animating book as a set of multiple ImageViews - each for page representation: Cover, BackCover, FirstPage. And after animation is finished launch activity or display fragment.
Animate with:
ObjectAnimator.ofFloat(mCover, "scaleY", ...)
ObjectAnimator.ofFloat(mCover, "x", ...)
ObjectAnimator.ofFloat(mCover, "rotationY", ...)
See my example
(Sure, this sample requires some optimizations/fixes, but for better understanding would be enough):
public class MainActivity extends AppCompatActivity {
    private ImageView mPage1;
    private ImageView mCover;
    private ImageView mCoverFullScreen;
    private AnimatorSet mAnimIncrease;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mCoverFullScreen = (ImageView) findViewById(R.id.cover_full_screen);
        mPage1 = (ImageView) findViewById(R.id.page1);
        mCover = (ImageView) findViewById(R.id.cover);
        mCover.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mAnimIncrease.start();
            }
        });
        mCoverFullScreen.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                if (mCover.getMeasuredHeight() <= 0 || mCoverFullScreen.getMeasuredHeight() <= 0) {
                    return;
                }
                if (Build.VERSION.SDK_INT >= 16) {
                    mCoverFullScreen.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                } else {
                    mCoverFullScreen.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                }
                initAnimator(1000);
            }
        });
    }
    private void initAnimator(long animationDuration) {
        mAnimIncrease = new AnimatorSet();
        TimeInterpolator interpolator = new LinearInterpolator();
        float deltaX = mCover.getMeasuredWidth() / 2f;
        float deltaY = mCoverFullScreen.getY() - mCover.getY();
        float scale = mCoverFullScreen.getMeasuredHeight() / (float) mCover.getMeasuredHeight();
        float scaleMiddle = (scale + 1) / 2f;
        float xStart = mCover.getX();
        float xEnd = xStart + deltaX;
        float xMiddle = xStart + deltaX * interpolator.getInterpolation(0.5f);
        float xScaledEnd = xStart + deltaX * scale;
        float yStart = mCover.getY();
        float yEnd = yStart + deltaY;
        float yMiddle = yStart + deltaY * interpolator.getInterpolation(0.5f);
        AnimatorSet coverFrontSet = new AnimatorSet();
        coverFrontSet.setDuration(animationDuration / 2);
        coverFrontSet.playTogether(
                ObjectAnimator.ofFloat(mCover, "rotationY", 0f, -90f),
                ObjectAnimator.ofFloat(mCover, "pivotX", 0f),
                ObjectAnimator.ofFloat(mCover, "x", xStart, xMiddle),
                ObjectAnimator.ofFloat(mCover, "y", yStart, yMiddle),
                ObjectAnimator.ofFloat(mCover, "scaleY", 1, scaleMiddle),
                ObjectAnimator.ofFloat(mCover, "scaleX", 1, scaleMiddle)
        );
        coverFrontSet.addListener(new AnimatorListenerStub() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                mCover.setImageResource(R.drawable.cover);
            }
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mCover.setImageResource(R.drawable.cover_back);
            }
        });
        AnimatorSet coverBackSet = new AnimatorSet();
        coverBackSet.setDuration(animationDuration / 2);
        coverBackSet.playTogether(
                ObjectAnimator.ofFloat(mCover, "rotationY", -90f, -180f),
                ObjectAnimator.ofFloat(mCover, "pivotX", 0f),
                ObjectAnimator.ofFloat(mCover, "x", xMiddle, xEnd),
                ObjectAnimator.ofFloat(mCover, "y", yMiddle, yEnd),
                ObjectAnimator.ofFloat(mCover, "scaleY", scaleMiddle, scale),
                ObjectAnimator.ofFloat(mCover, "scaleX", scaleMiddle, scale)
        );
        AnimatorSet coverSet = new AnimatorSet();
        coverSet.play(coverBackSet).after(coverFrontSet);
        AnimatorSet page1Set = new AnimatorSet();
        page1Set.setDuration(animationDuration);
        page1Set.playTogether(
                ObjectAnimator.ofFloat(mPage1, "scaleX", 1, scale),
                ObjectAnimator.ofFloat(mPage1, "scaleY", 1, scale),
                ObjectAnimator.ofFloat(mPage1, "x", xStart, xScaledEnd)
        );
        mAnimIncrease.play(coverSet).with(page1Set);
        mAnimIncrease.setInterpolator(interpolator);
    }
}
And Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".MainActivity"
    >
    <ImageView
        android:id="@+id/page1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/page1"
        />
    <ImageView
        android:id="@+id/cover"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/cover"
        />
    <ImageView
        android:id="@+id/cover_full_screen"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />
</RelativeLayout>

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With