getInterpolation(float t)戻り値は次のとおりです。(k + 1)* t 3-k * t 2
AnticipateOvershootInterpolator
効果:変化の速度は速く始まり、次に遅くなり、最後にリバウンド効果があり、1回リバウンドします。
getInterpolation(float t)戻り回值: a(t、s)= t * t *((s + 1)* t --s ); o(t、s)= t * t *((s + 1)* t + s); f(t)= 0.5 * a(t * 2、張力* extraTension)、t <0.5の場合; f(t)= 0.5 *(o(t * 2-2、tension * extraTension)+ 2)、t <= 1.0の場合;
BounceInterpolator
効果:変化の速度はどんどん速くなり、最後にリバウンド振動効果があります。
getInterpolation(float t)戻り回值:_b(t)= t * t * 8; bs(t)= _b(t)for t <0.3535; bs(t)= _b(t --0.54719)+ 0.7 for t <0.7408; bs(t)= _b(t-0.8526)+ 0.9 for t <0.9644; bs(t)= _b(t-1.0435)+ 0.95 for t <= 1.0; b(t)= bs(t * 1.1226);
class CustomEvaluator implements TypeEvaluator<Number> {
@Override
public Number evaluate(float fraction, Number startValue, Number endValue) {
return null;
}
}
上記の例を再実装します
ドットエンティティクラスを作成する
/**
* 圆形的实体类
*/
public class Cicle {
//圆点x坐标
private float xCenter;
//圆点y坐标
private float yCenter;
//半径
private float radius;
public Cicle() {
}
public Cicle(float xCenter, float yCenter, float radius) {
this.xCenter = xCenter;
this.yCenter = yCenter;
this.radius = radius;
}
public float getxCenter() {
return xCenter;
}
public void setxCenter(float xCenter) {
this.xCenter = xCenter;
}
public float getyCenter() {
return yCenter;
}
public void setyCenter(float yCenter) {
this.yCenter = yCenter;
}
public float getRadius() {
return radius;
}
public void setRadius(float radius) {
this.radius = radius;
}
}
円を描くためのカスタムビュー
public class CicleView extends View {
private Paint paint;
private Cicle cicle;
public CicleView(Context context) {
super(context);
init();
}
public CicleView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
public CicleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public void setCicle(Cicle cicle) {
this.cicle = cicle;
invalidate();
}
private void init() {
paint = new Paint();
paint.setColor(Color.BLUE);
paint.setAntiAlias(true);
paint.setMaskFilter(new BlurMaskFilter(2f, BlurMaskFilter.Blur.NORMAL));
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
cicle.setxCenter(width / 2);
cicle.setyCenter(height / 2);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawCircle(cicle.getxCenter(), cicle.getyCenter(), cicle.getRadius(), paint);
}
}