ProfileAnimatedMenu.java 文件源码

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

项目:ModesoActionOverlay-Android 作者:
/**
 * Animates the passed view as following :scale downed to 0 ,
 * reduced alpha to 0 and a 360 degree rotation if allowed
 * @param view the view to animate
 * @param delay delay before starting the animation
 */
void animateMenuItemClose(View view,long delay){
    ObjectAnimator animScaleX = ObjectAnimator.ofFloat(view,"scaleX",1.0f,0.2f);
    ObjectAnimator animScaleY = ObjectAnimator.ofFloat(view,"scaleY",1.0f,0.2f);
    ObjectAnimator animAlpha = ObjectAnimator.ofFloat(view,"alpha",ITEM_FINAL_ALPHA,0.0f);
    ObjectAnimator animRotation = ObjectAnimator.ofFloat(view,"rotation",360.0f,0);

    final int X_SCALE_ANIMATION_DURATION = 400;
    final int Y_SCALE_ANIMATION_DURATION = 400;
    final int ALPHA_ANIMATION_DURATION = 300;

    animScaleX.setDuration(X_SCALE_ANIMATION_DURATION);
    animScaleY.setDuration(Y_SCALE_ANIMATION_DURATION);
    animAlpha.setDuration(ALPHA_ANIMATION_DURATION);

    animRotation.setDuration(500);

    AnimatorSet animSet = new AnimatorSet();
    if(allowItemRotationAnim)
        animSet.playTogether(animScaleX,animScaleY,animAlpha,animRotation);
    else
        animSet.playTogether(animScaleX,animScaleY,animAlpha);
    animSet.setInterpolator(new OvershootInterpolator(2));
    animSet.setStartDelay(delay);
    animSet.start();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号