animated-rotated动画加载

摘自https://blog.csdn.net/yinsujun11/article/details/49931141

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:fromDegrees="0.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50.0%"
android:pivotY="50.0%"
android:repeatMode="restart"
android:toDegrees="360.0" 
android:drawable="@mipmap/pull_icon">
</animated-rotate>

duration:动画开始到结束的执行时间

fromDegrees: 设置动画开始时的角度

toDegrees:设置动画结束时的旋转角度

pivotX : 设置动画相对于控件的 x 坐标的位置

pivotY:设置动画相对于控件的 y 坐标的位置

repeatMode:

动画的进度使用 Interpolator 控制。Interpolator 定义了动画的变化速度,可以实现匀速、正加速、负加速、无规则变加速等。Interpolator 是基类,封装了所有 Interpolator 的共同方法,它只有一个方法,即 getInterpolation (float input),该方法 maps a point on the timeline to a multiplier to be applied to the transformations of an animation。Android 提供了几个 Interpolator 子类,实现了不同的速度曲线,如下:

AccelerateDecelerateInterpolator 在动画开始与介绍的地方速率改变比较慢,在中间的时侯加速

AccelerateInterpolator 在动画开始的地方速率改变比较慢,然后开始加速

CycleInterpolator 动画循环播放特定的次数,速率改变沿着正弦曲线

DecelerateInterpolator 在动画开始的地方速率改变比较慢,然后开始减速

LinearInterpolator 在动画的以均匀的速率改变

对于 LinearInterpolator ,变化率是个常数,即 f (x) = x.
public float getInterpolation(float input) {
return input;
}

猜你喜欢

转载自www.cnblogs.com/yfafa/p/9077270.html