ImageView 呼吸動畫

0.代碼實現

private void initShotAnim(ImageView iv) {
        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animatorX = ObjectAnimator.ofFloat(iv, "scaleX", 1f, 1.2f, 1f);
        ObjectAnimator animatorY = ObjectAnimator.ofFloat(iv, "scaleY", 1f, 1.2f, 1f);
        animatorX.setRepeatCount(-1);
        animatorY.setRepeatCount(-1);
        animatorSet.play(animatorX).with(animatorY);
        animatorSet.setDuration(600).start();
    }

1.使用

initShotAnim(iv);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章