概述
缩放动画(单一动画)
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="5000"
android:fillBefore="true"
android:fromXScale="1.1"
android:fromYScale="1.1"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toXScale="1.6"
android:toYScale="1.6" />
</set>
旋转动画(单一动画)
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="5000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="0%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toDegrees="85" />
</set>
组合动画(旋转与淡出)
private void multiAnimation(ImageView head) {
head.setPivotX(head.getWidth() / 2);//设置指定旋转中心点X坐标
head.setPivotY(0);//设置指定旋转中心点Y坐标
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(head, "alpha", 1.0f, 0f);
//旋转不停顿
objectAnimator1.setInterpolator(new LinearInterpolator());
objectAnimator1.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator1.setRepeatMode(ValueAnimator.RESTART);
ObjectAnimator objectAnimator3 = ObjectAnimator.ofFloat(head, "rotation", 0.0f, 90.0f);
objectAnimator3.setInterpolator(new LinearInterpolator());
objectAnimator3.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator3.setRepeatMode(ValueAnimator.RESTART);
/**
* mArrowImageView.setPivotX(mArrowImageView.getMeasureWidth() / 2);
* mArrowImageView.setPivotY(mArrowImageView.getMeasureHeight() / 2);
*/
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(objectAnimator1).with(objectAnimator3);
animatorSet.setDuration(2000);
animatorSet.start();
}
组合动画 (缩放效果, x 轴 Y轴)
/** * 光晕的效果 缩放 * * @param head */ private void sunMmultiAnimationScale(ImageView head) { ObjectAnimator objectAnimator4 = ObjectAnimator.ofFloat(head, "scaleX", 1.0f, 2.1f, 1.0f); ObjectAnimator objectAnimator5 = ObjectAnimator.ofFloat(head, "scaleY", 1.0f, 2.1f, 1.0f); objectAnimator4.setRepeatCount(ValueAnimator.INFINITE); objectAnimator4.setRepeatMode(ValueAnimator.RESTART); objectAnimator5.setRepeatCount(ValueAnimator.INFINITE); objectAnimator5.setRepeatMode(ValueAnimator.RESTART); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(objectAnimator4).with(objectAnimator5); animatorSet.setDuration(SUN_PLAY_TIME); animatorSet.start(); }
最后
以上就是欢喜小猫咪为你收集整理的阳光的光圈通过旋转 ,动画实现的全部内容,希望文章能够帮你解决阳光的光圈通过旋转 ,动画实现所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复