Methods Summary |
---|
public Keyframes | clone()
Keyframes clone = null;
try {
clone = (Keyframes) super.clone();
} catch (CloneNotSupportedException e) {}
return clone;
|
public FloatKeyframes | createXFloatKeyframes()Returns a FloatKeyframes for the X component of the Path.
return new FloatKeyframesBase() {
@Override
public float getFloatValue(float fraction) {
PointF pointF = (PointF) PathKeyframes.this.getValue(fraction);
return pointF.x;
}
};
|
public IntKeyframes | createXIntKeyframes()Returns an IntKeyframes for the X component of the Path.
return new IntKeyframesBase() {
@Override
public int getIntValue(float fraction) {
PointF pointF = (PointF) PathKeyframes.this.getValue(fraction);
return Math.round(pointF.x);
}
};
|
public FloatKeyframes | createYFloatKeyframes()Returns a FloatKeyframes for the Y component of the Path.
return new FloatKeyframesBase() {
@Override
public float getFloatValue(float fraction) {
PointF pointF = (PointF) PathKeyframes.this.getValue(fraction);
return pointF.y;
}
};
|
public IntKeyframes | createYIntKeyframes()Returns an IntKeyframeSet for the Y component of the Path.
return new IntKeyframesBase() {
@Override
public int getIntValue(float fraction) {
PointF pointF = (PointF) PathKeyframes.this.getValue(fraction);
return Math.round(pointF.y);
}
};
|
public java.util.ArrayList | getKeyframes()
return EMPTY_KEYFRAMES;
|
public java.lang.Class | getType()
return PointF.class;
|
public java.lang.Object | getValue(float fraction)
int numPoints = mKeyframeData.length / 3;
if (fraction < 0) {
return interpolateInRange(fraction, 0, 1);
} else if (fraction > 1) {
return interpolateInRange(fraction, numPoints - 2, numPoints - 1);
} else if (fraction == 0) {
return pointForIndex(0);
} else if (fraction == 1) {
return pointForIndex(numPoints - 1);
} else {
// Binary search for the correct section
int low = 0;
int high = numPoints - 1;
while (low <= high) {
int mid = (low + high) / 2;
float midFraction = mKeyframeData[(mid * NUM_COMPONENTS) + FRACTION_OFFSET];
if (fraction < midFraction) {
high = mid - 1;
} else if (fraction > midFraction) {
low = mid + 1;
} else {
return pointForIndex(mid);
}
}
// now high is below the fraction and low is above the fraction
return interpolateInRange(fraction, high, low);
}
|
private static float | interpolate(float fraction, float startValue, float endValue)
float diff = endValue - startValue;
return startValue + (diff * fraction);
|
private android.graphics.PointF | interpolateInRange(float fraction, int startIndex, int endIndex)
int startBase = (startIndex * NUM_COMPONENTS);
int endBase = (endIndex * NUM_COMPONENTS);
float startFraction = mKeyframeData[startBase + FRACTION_OFFSET];
float endFraction = mKeyframeData[endBase + FRACTION_OFFSET];
float intervalFraction = (fraction - startFraction)/(endFraction - startFraction);
float startX = mKeyframeData[startBase + X_OFFSET];
float endX = mKeyframeData[endBase + X_OFFSET];
float startY = mKeyframeData[startBase + Y_OFFSET];
float endY = mKeyframeData[endBase + Y_OFFSET];
float x = interpolate(intervalFraction, startX, endX);
float y = interpolate(intervalFraction, startY, endY);
mTempPointF.set(x, y);
return mTempPointF;
|
public void | invalidateCache()
|
private android.graphics.PointF | pointForIndex(int index)
int base = (index * NUM_COMPONENTS);
int xOffset = base + X_OFFSET;
int yOffset = base + Y_OFFSET;
mTempPointF.set(mKeyframeData[xOffset], mKeyframeData[yOffset]);
return mTempPointF;
|
public void | setEvaluator(TypeEvaluator evaluator)
|