贝塞尔曲线属性动画的封装。
@OverridepublicvoidonClick(Viewview) {
AnimatorPathpath = newAnimatorPath.Builder()
.moveTo(0, 0)
.quadTo(-300, 800, -600, 0)
.lineTo(0, 0)
.cubicTo(-200, 200, -400, 100, -600, 0)
.lineTo(0, 0)
.build();
ObjectAnimatoranimator = ObjectAnimator
.ofObject(this, "location", newPathEvaluator(), path.getPoints())
.setDuration(4000);
animator.setInterpolator(newLinearInterpolator());
animator.start();
}
publicvoidsetLocation(PathPointp) {
textView.setTranslationX(p.x);
textView.setTranslationY(p.y);
}