@@ -0,0 +1,1251 @@
+package andy.zhu.android.eleganceinterpolator;%0A%0Aimport android.view.animation.Interpolator;%0A%0A/**%0A * Created by zhujinchang on 2017/4/13.%0A */%0A%0Apublic class CurveInterpolator implements Interpolator %7B%0A%0A    private float mCpx;%0A    private float mCpy;%0A%0A    /**%0A     * @param cpx X of the control point%0A     * @param cpy Y of the control point%0A     */%0A    public CurveInterpolator(float cpx, float cpy) %7B%0A        this.mCpx = cpx;%0A        this.mCpy = cpy;%0A    %7D%0A%0A    @Override%0A    public float getInterpolation(float x) %7B%0A        float ax, bx;%0A        float ay, by;%0A%0A//        bx = 2f * (cp%5B1%5D.x - cp%5B0%5D.x);%0A//        ax = cp%5B2%5D.x - cp%5B0%5D.x - bx;%0A        bx = 2f * mCpx;%0A        ax = 1 - bx;%0A%0A        by = 2f * mCpy;%0A        ay = 1 - by;%0A%0A//        float t;%0A//        tSquared = t * t;%0A//        x == (ax * tSquared) + (bx * t) + cp%5B0%5D.x;%0A//        (ax * tSquared) + (bx * t) + cp%5B0%5D.x - x == 0%0A        float delta = bx * bx - 4 * ax * (-x); // bx * bx - 4 * ax * (cp%5B0%5D.x - x);%0A        float t1 = (-bx + (float) Math.sqrt(delta)) / (2 * ax);%0A        float t2 = (-bx - (float) Math.sqrt(delta)) / (2 * ax);%0A        float t = t1 %3E= 0 && t1 %3C 1 ? t1 : t2;%0A%0A//        return  (ay * t * t) + (by * t) + cp%5B0%5D.y;%0A        return  (ay * t * t) + (by * t);%0A    %7D%0A%7D%0A

Add CurveInterpolator