public class PathInterpolator extends BaseInterpolator
Point
(0, 0)
to (1, 1)
. The x coordinate along the Path
is the input value and the output is the y coordinate of the line at that point.
This means that the Path must conform to a function y = f(x)
.
The Path
must not have gaps in the x direction and must not
loop back on itself such that there can be two points sharing the same x coordinate.
It is alright to have a disjoint line in the vertical direction:
Path path = new Path(); path.lineTo(0.25f, 0.25f); path.moveTo(0.25f, 0.5f); path.lineTo(1f, 1f);
Constructor and Description |
---|
PathInterpolator(Context context,
AttributeSet attrs) |
PathInterpolator(float controlX,
float controlY)
Create an interpolator for a quadratic Bezier curve.
|
PathInterpolator(float controlX1,
float controlY1,
float controlX2,
float controlY2)
Create an interpolator for a cubic Bezier curve.
|
PathInterpolator(Path path)
Create an interpolator for an arbitrary
Path . |
PathInterpolator(Resources res,
Resources.Theme theme,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
float |
getInterpolation(float t)
Using the line in the Path in this interpolator that can be described as
y = f(x) , finds the y coordinate of the line given t
as the x coordinate. |
getChangingConfiguration
public PathInterpolator(Path path)
Path
. The Path
must begin at (0, 0)
and end at (1, 1)
.path
- The Path
to use to make the line representing the interpolator.public PathInterpolator(float controlX, float controlY)
(0, 0)
and (1, 1)
are assumed.controlX
- The x coordinate of the quadratic Bezier control point.controlY
- The y coordinate of the quadratic Bezier control point.public PathInterpolator(float controlX1, float controlY1, float controlX2, float controlY2)
(0, 0)
and (1, 1)
are assumed.controlX1
- The x coordinate of the first control point of the cubic Bezier.controlY1
- The y coordinate of the first control point of the cubic Bezier.controlX2
- The x coordinate of the second control point of the cubic Bezier.controlY2
- The y coordinate of the second control point of the cubic Bezier.public PathInterpolator(Context context, AttributeSet attrs)
public PathInterpolator(Resources res, Resources.Theme theme, AttributeSet attrs)
public float getInterpolation(float t)
y = f(x)
, finds the y coordinate of the line given t
as the x coordinate. Values less than 0 will always return 0 and values greater
than 1 will always return 1.t
- Treated as the x coordinate along the line.t
.TimeInterpolator.getInterpolation(float)