52 lines
2.0 KiB
Java
52 lines
2.0 KiB
Java
|
package com.airbnb.lottie.animation.keyframe;
|
||
|
|
||
|
import android.graphics.Path;
|
||
|
import android.graphics.PathMeasure;
|
||
|
import android.graphics.PointF;
|
||
|
import com.airbnb.lottie.value.Keyframe;
|
||
|
import java.util.List;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class PathKeyframeAnimation extends KeyframeAnimation<PointF> {
|
||
|
private final PathMeasure pathMeasure;
|
||
|
private PathKeyframe pathMeasureKeyframe;
|
||
|
private final PointF point;
|
||
|
private final float[] pos;
|
||
|
|
||
|
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
|
||
|
public /* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
|
||
|
return getValue((Keyframe<PointF>) keyframe, f);
|
||
|
}
|
||
|
|
||
|
public PathKeyframeAnimation(List<? extends Keyframe<PointF>> list) {
|
||
|
super(list);
|
||
|
this.point = new PointF();
|
||
|
this.pos = new float[2];
|
||
|
this.pathMeasure = new PathMeasure();
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
|
||
|
public PointF getValue(Keyframe<PointF> keyframe, float f) {
|
||
|
PointF pointF;
|
||
|
PathKeyframe pathKeyframe = (PathKeyframe) keyframe;
|
||
|
Path path = pathKeyframe.getPath();
|
||
|
if (path == null) {
|
||
|
return keyframe.startValue;
|
||
|
}
|
||
|
if (this.valueCallback != null && (pointF = (PointF) this.valueCallback.getValueInternal(pathKeyframe.startFrame, pathKeyframe.endFrame.floatValue(), (PointF) pathKeyframe.startValue, (PointF) pathKeyframe.endValue, getLinearCurrentKeyframeProgress(), f, getProgress())) != null) {
|
||
|
return pointF;
|
||
|
}
|
||
|
if (this.pathMeasureKeyframe != pathKeyframe) {
|
||
|
this.pathMeasure.setPath(path, false);
|
||
|
this.pathMeasureKeyframe = pathKeyframe;
|
||
|
}
|
||
|
PathMeasure pathMeasure = this.pathMeasure;
|
||
|
pathMeasure.getPosTan(f * pathMeasure.getLength(), this.pos, null);
|
||
|
PointF pointF2 = this.point;
|
||
|
float[] fArr = this.pos;
|
||
|
pointF2.set(fArr[0], fArr[1]);
|
||
|
return this.point;
|
||
|
}
|
||
|
}
|