Interpolator 被用来修饰动画效果,定义动画的变化率,可以使存在的动画效果accelerated(加速),decelerated(减速),repeated(重复),bounced(弹跳)等。
android中的文档内容如下:
如果android定义的interpolators不符合你的效果也可以自定义interpolators
对于一个抖动的效果
Animation shake = AnimationUtils.loadAnimation(this,R.anim.shake);
shake.setInterpolator(new Interpolator()){
public float getInterpolation(float x){
int y = 0;
//y=ax+b一种曲线的效果
//其实就是在我们xy坐标系中的轨迹线。理解这个就能理解interpolator的效果
return y;
}
}