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);
Public constructors |
|
|---|---|
PathInterpolator(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) 使用此插补器中的路径中的行(可描述为 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
android.animation.TimeInterpolator
|
|
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 (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 (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 (Context context, AttributeSet attrs)
| 参数(Parameters) | |
|---|---|
context |
Context
|
attrs |
AttributeSet
|
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. |
也可以看看: