DefaultCardStreamAnimator.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:android-play-places 作者:
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeInAnimator(View view, float deltaX, float deltaY){

    float deltaXAbs = Math.abs(deltaX);

    float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
    long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));

    // Animate position and alpha of swiped item

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1.f),
            PropertyValuesHolder.ofFloat("translationX", 0.f),
            PropertyValuesHolder.ofFloat("rotationY", 0.f));

    animator.setDuration(duration).setInterpolator(new BounceInterpolator());

    return  animator;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号