美文网首页
FlipVerticalTransformer

FlipVerticalTransformer

作者: 菜鸟何时起飞 | 来源:发表于2020-05-14 14:07 被阅读0次
    FlipVerticalTransformer.gif
    public class FlipVerticalTransformer extends ABaseTransformer {
    
        @Override
        protected void onTransform(View view, float position) {
            final float rotation = -180f * position;
    
            view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
            view.setPivotX(view.getWidth() * 0.5f);
            view.setPivotY(view.getHeight() * 0.5f);
            view.setRotationX(rotation);
        }
    
        @Override
        protected void onPostTransform(View page, float position) {
            super.onPostTransform(page, position);
    
            if (position > -0.5f && position < 0.5f) {
                page.setVisibility(View.VISIBLE);
            } else {
                page.setVisibility(View.INVISIBLE);
            }
        }
    }
    

    相关文章

      网友评论

          本文标题:FlipVerticalTransformer

          本文链接:https://www.haomeiwen.com/subject/ooktohtx.html