Most visited

Recently visited

Added in API level 21

PathInterpolator

public class PathInterpolator
extends BaseInterpolator

java.lang.Object
   ↳ android.view.animation.BaseInterpolator
     ↳ android.view.animation.PathInterpolator


可以遍历从Point (0, 0)延伸到Point的Path的插补(1, 1) 沿着Path的x坐标是输入值,输出是该点处的线的y坐标。 这意味着该路径必须符合功能y = f(x)

Path在x方向上一定不能有间隙,并且不能在自身上循环,这样可以有两个点共享相同的x坐标。 在垂直方向上有一条不相交的线是可以的:

     Path path = new Path();
     path.lineTo(0.25f, 0.25f);
     path.moveTo(0.25f, 0.5f);
     path.lineTo(1f, 1f);
 

Summary

Public constructors

PathInterpolator(Path path)

为任意 Path创建一个插补 Path

PathInterpolator(float controlX, float controlY)

为二次贝塞尔曲线创建一个插补器。

PathInterpolator(float controlX1, float controlY1, float controlX2, float controlY2)

为三次贝塞尔曲线创建一个插补器。

PathInterpolator(Context context, AttributeSet attrs)

Public methods

float getInterpolation(float t)

使用此插补器中的路径中的行(可描述为 y = f(x) ,可找到给定 t的行的y坐标作为x坐标。

Inherited methods

From class java.lang.Object
From interface android.animation.TimeInterpolator

Public constructors

PathInterpolator

Added in API level 21
PathInterpolator (Path path)

为任意Path创建一个插补Path Path必须在开始(0, 0) ,并在结束(1, 1)

Parameters
path Path: The Path to use to make the line representing the interpolator.

PathInterpolator

Added in API level 21
PathInterpolator (float controlX, 
                float controlY)

为二次贝塞尔曲线创建一个插补器。 假定终点(0, 0)(1, 1)

Parameters
controlX float: The x coordinate of the quadratic Bezier control point.
controlY float: The y coordinate of the quadratic Bezier control point.

PathInterpolator

Added in API level 21
PathInterpolator (float controlX1, 
                float controlY1, 
                float controlX2, 
                float controlY2)

为三次贝塞尔曲线创建一个插补器。 假设终点(0, 0)(1, 1)

Parameters
controlX1 float: The x coordinate of the first control point of the cubic Bezier.
controlY1 float: The y coordinate of the first control point of the cubic Bezier.
controlX2 float: The x coordinate of the second control point of the cubic Bezier.
controlY2 float: The y coordinate of the second control point of the cubic Bezier.

PathInterpolator

Added in API level 21
PathInterpolator (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

Public methods

getInterpolation

Added in API level 21
float getInterpolation (float t)

使用此插补器中的路径中的行(可描述为y = f(x) ,可找到给定t的行的y坐标作为x坐标。 小于0的值将始终返回0,大于1的值将始终返回1。

Parameters
t float: Treated as the x coordinate along the line.
Returns
float The y coordinate of the Path along the line where x = t.

也可以看看:

Hooray!