美文网首页
ForegroundToBackgroundTransforme

ForegroundToBackgroundTransforme

作者: 菜鸟何时起飞 | 来源:发表于2020-05-14 14:07 被阅读0次
    ForegroundToBackground.gif
    public class ForegroundToBackgroundTransformer extends ABaseTransformer {
    
        @Override
        protected void onTransform(View view, float position) {
            final float height = view.getHeight();
            final float width = view.getWidth();
            final float scale = min(position > 0 ? 1f : Math.abs(1f + position), 0.5f);
    
            view.setScaleX(scale);
            view.setScaleY(scale);
            view.setPivotX(width * 0.5f);
            view.setPivotY(height * 0.5f);
            view.setTranslationX(position > 0 ? width * position : -width * position * 0.25f);
        }
    
    }
    

    相关文章

      网友评论

          本文标题:ForegroundToBackgroundTransforme

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