PointFEvaluatorpublic class PointFEvaluator extends Object implements TypeEvaluatorThis evaluator can be used to perform type interpolation between PointF values. |
Fields Summary |
---|
private android.graphics.PointF | mPointWhen null, a new PointF is returned on every evaluate call. When non-null,
mPoint will be modified and returned on every evaluate. |
Constructors Summary |
---|
public PointFEvaluator()Construct a PointFEvaluator that returns a new PointF on every evaluate call.
To avoid creating an object for each evaluate call,
{@link PointFEvaluator#PointFEvaluator(android.graphics.PointF)} should be used
whenever possible.
| public PointFEvaluator(android.graphics.PointF reuse)Constructs a PointFEvaluator that modifies and returns reuse
in {@link #evaluate(float, android.graphics.PointF, android.graphics.PointF)} calls.
The value returned from
{@link #evaluate(float, android.graphics.PointF, android.graphics.PointF)} should
not be cached because it will change over time as the object is reused on each
call.
mPoint = reuse;
|
Methods Summary |
---|
public android.graphics.PointF | evaluate(float fraction, android.graphics.PointF startValue, android.graphics.PointF endValue)This function returns the result of linearly interpolating the start and
end PointF values, with fraction representing the proportion
between the start and end values. The calculation is a simple parametric
calculation on each of the separate components in the PointF objects
(x, y).
If {@link #PointFEvaluator(android.graphics.PointF)} was used to construct
this PointFEvaluator, the object returned will be the reuse
passed into the constructor.
float x = startValue.x + (fraction * (endValue.x - startValue.x));
float y = startValue.y + (fraction * (endValue.y - startValue.y));
if (mPoint != null) {
mPoint.set(x, y);
return mPoint;
} else {
return new PointF(x, y);
}
|
|