1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Androidのアニメーション(着信)

Posted at

#アニメーション効果

着信アニメション.gif

#1、画像設定

            imageView.setImageResource(R.mipmap.tellphone);
            objectAnimator = AnimationUtil2.getTellphoneAnimation(imageView);

#2、アニメション設定

public static ObjectAnimator getTellphoneAnimation(ImageView imageView) {
    Keyframe frame0 = Keyframe.ofFloat(0f, 0);
    Keyframe frame1 = Keyframe.ofFloat(0.1f, -20f);
    Keyframe frame2 = Keyframe.ofFloat(0.2f, 20f);
    Keyframe frame3 = Keyframe.ofFloat(0.3f, -20f);
    Keyframe frame4 = Keyframe.ofFloat(0.4f, 20f);
    Keyframe frame5 = Keyframe.ofFloat(0.5f, -20f);
    Keyframe frame6 = Keyframe.ofFloat(0.6f, 20f);
    Keyframe frame7 = Keyframe.ofFloat(0.7f, -20f);
    Keyframe frame8 = Keyframe.ofFloat(0.8f, 20f);
    Keyframe frame9 = Keyframe.ofFloat(0.9f, -20f);
    Keyframe frame10 = Keyframe.ofFloat(1, 0);
    PropertyValuesHolder frameHolder = PropertyValuesHolder.ofKeyframe
            ("rotation",frame0,frame1,frame2,frame3,frame4,frame5,frame6,frame7,frame8,frame9,frame10);
    ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(imageView,frameHolder);
    objectAnimator.setDuration(1000);
    objectAnimator.setRepeatCount(2);
    objectAnimator.setRepeatMode(ValueAnimator.RESTART);
    return objectAnimator;
}

#3、アニメション開始

            objectAnimator.start();

いいねも忘れずに:point_up:

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?