Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaled Flip animation #45

Open
jurajjarabek opened this issue Mar 17, 2014 · 1 comment
Open

Scaled Flip animation #45

jurajjarabek opened this issue Mar 17, 2014 · 1 comment

Comments

@jurajjarabek
Copy link

Hey guys please help, I've been stuck for many days with this:
I am using Horizontal flip Animation. To me, animation doesn't seem perfect because the edges of the view are coming out of the screen while rotating it. Anyway, what I am trying to do is to scale the view while rotating it - make it smaller during the rotation. To me It seems, that while rotating the view scale doesn't work at all. When I don't use rotation scale is working correctly. Please help ! Here is my code:

    if (mState != State.IDLE) {
        if (left != null) {
            manageLayer(left, true);
            mRot = -180.0f * positionOffset;

            if (mRot < -90.0f) {
                left.setVisibility(View.INVISIBLE);
            } else {
                if (left.getVisibility() == View.INVISIBLE)
                    left.setVisibility(View.VISIBLE);
                mTrans = positionOffsetPixels;
                mScale = ZOOM_MAX + (1-ZOOM_MAX)*(1-positionOffset);

                ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
                ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
                ViewHelper.setScaleX(left, mScale);
                ViewHelper.setScaleY(left, mScale);
                ViewHelper.setTranslationX(left, mTrans);
                ViewHelper.setRotationY(left, mRot);
            }
        }

        if (right != null) {
            manageLayer(right, true);
            mRot = 180.0f * (1-positionOffset);

            if (mRot > 90.0f) {
                right.setVisibility(View.INVISIBLE);
            } else {
                if (right.getVisibility() == View.INVISIBLE)
                    right.setVisibility(View.VISIBLE);
                mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
                mScale = ZOOM_MAX + (1-ZOOM_MAX)*positionOffset;

                ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
                ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
                ViewHelper.setScaleX(right, mScale);
                ViewHelper.setScaleY(right, mScale);
                ViewHelper.setTranslationX(right, mTrans);
                ViewHelper.setRotationY(right, mRot);
            }
        }
    }
@jurajjarabek
Copy link
Author

anybody ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant