我必须为路径点的其他位置设置弯曲路径的动画。我正在使用cubicTo和这样的五点:
Path mainFillPath = new Path();
mainFillPath.reset();
mainFillPath.moveTo(leftPointX, leftPointY);
mainFillPath.cubicTo(leftPointX, leftPointY, centerPointX1, centerPointY1, centerPointX, centerPointY);
mainFillPath.cubicTo(centerPointX, centerPointY, centerPointX2, centerPointY2, rightPointX, rightPointY);
mainFillPath.lineTo(rightPointX, 0);
mainFillPath.lineTo(0, 0);
mainFillPath.close();
我在画布canvas.drawPath(myPath, paint);
我必须使用什么动画师才能获得此波形结果:
我从一些项目中尝试过ObjectAnimator和ValueAnimator。其中一个是使用PathEvaluator()来动画某个路径上的移动按钮,如下所示:
final ObjectAnimator anim = ObjectAnimator.ofObject(this, "buttonLoc",
new PathEvaluator(), path.getPoints().toArray());
anim.setDuration(2000);