美文网首页
ZoomInTransformer

ZoomInTransformer

作者: 菜鸟何时起飞 | 来源:发表于2020-05-14 14:07 被阅读0次
ZoomInTransformer.gif
public class ZoomInTransformer extends ABaseTransformer {

    @Override
    protected void onTransform(View view, float position) {
        final float scale = position < 0 ? position + 1f : Math.abs(1f - position);
        view.setScaleX(scale);
        view.setScaleY(scale);
        view.setPivotX(view.getWidth() * 0.5f);
        view.setPivotY(view.getHeight() * 0.5f);
        view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
    }

}

相关文章

网友评论

      本文标题:ZoomInTransformer

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