Interpolator使用基础

getInterpolation

getInterpolation(float input)就像是我们根据x求函数值的y一样,可以用到我们需要的各种场景。

PathInterpolator mPathInterpolator = new PathInterpolator(0.67f,0f,0.77f, 0.43f);
        for(float p = 0f; p<1.0f; p+=0.1f){
            float y = mPathInterpolator.getInterpolation(p);
            Log.e("Test", "p = " + p + ",y = " + y);
        }

输出结果:

p = 0.0,y = 0.0
p = 0.1,y = 0.0037420532
p = 0.2,y = 0.016043596
p = 0.3,y = 0.03810103
p = 0.4,y = 0.07357832
p = 0.5,y = 0.12979272
p = 0.6,y = 0.21264362
p = 0.70000005,y = 0.33630598
p = 0.8000001,y = 0.5133318
p = 0.9000001,y = 0.7469782

你可能感兴趣的:(Android开发,Android,动画)