jazzy viewpager scale flip

时间:2014-03-17 08:41:38

标签: android animation flip

嘿伙计们(对于那些正在使用Jazzyviewpager的人)。 我正在使用水平翻转动画。对我来说,动画似乎并不完美,因为视图的边缘在旋转时会从屏幕出来。 无论如何,我想要做的是在旋转时缩放视图 - 在旋转过程中缩小视图。 对我来说似乎,旋转视图比例时根本不起作用。当我不使用旋转秤工作正常。请帮忙 ! 这是我的代码:

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);
            }
        }
    }

0 个答案:

没有答案