FileDocCategorySizeDatePackage
PointFEvaluator.javaAPI DocAndroid 5.1 API3170Thu Mar 12 22:22:08 GMT 2015android.animation

PointFEvaluator

public class PointFEvaluator extends Object implements TypeEvaluator
This evaluator can be used to perform type interpolation between PointF values.

Fields Summary
private android.graphics.PointF
mPoint
When 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.

param
reuse A PointF to be modified and returned by evaluate.

        mPoint = reuse;
    
Methods Summary
public android.graphics.PointFevaluate(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.

param
fraction The fraction from the starting to the ending values
param
startValue The start PointF
param
endValue The end PointF
return
A linear interpolation between the start and end values, given the fraction parameter.

        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);
        }