用Path属性记录椭圆的轨迹:
Path path = new Path();
RectF rectF = new RectF(left, top, right, bottom);
path.addOval(rectF, Path.Direction.CW);
API21以上可直接用属性动画里的方法(5.0以上) ObjectAnimator traslateAnimator = ObjectAnimator.ofFloat(imageView, "x", "y", path);
traslateAnimator.start();
如果API为21以下就要通过PathMeasure:
package com.wyt.hcy.trajectoryanimationdemo;
import android.animation.ObjectAnimator;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.RectF;
import android.util.Log;
import android.widget.ImageView;
import com.nineoldandroids.animation.ValueAnimator;
/**
* Created by hcy on 2017/7/14 0014.
* <p>
* func 动画工具类
*/
public class AnimationUtils {
private sta