Android move object along a path

后端 未结 5 1696
天涯浪人
天涯浪人 2020-12-14 18:33

I ave created a path a circle and displayed both of them on screen as follows:

public void onDraw(Canvas canvas){

        Path sPath = new Path();
        s         


        
5条回答
  •  渐次进展
    2020-12-14 19:12

    v21+: this creates a quadratic bezier curve on a path and animates myView along it.

    final Path path = new Path();
    path.quadTo(controlX, controlY, finalX, finalY);
    ObjectAnimator.ofFloat(myView, View.X, View.Y, path).start();
    

提交回复
热议问题