blob: 920c17f5160d88b26c9b69eb86cb899603cdf38a [file] [log] [blame]
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.animation.Keyframe;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.Collections;
public class ValueCallbackKeyframeAnimation<K, A> extends BaseKeyframeAnimation<K, A> {
public ValueCallbackKeyframeAnimation(LottieValueCallback<A> valueCallback) {
super(Collections.<Keyframe<K>>emptyList());
setValueCallback(valueCallback);
}
@Override public void setProgress(float progress) {
super.setProgress(progress);
}
/**
* If this doesn't return 1, then {@link #setProgress(float)} will always clamp the progress
* to 0.
*/
@Override float getEndProgress() {
return 1f;
}
@Override void notifyListeners() {
if (this.valueCallback != null) {
super.notifyListeners();
}
}
@Override public A getValue() {
//noinspection ConstantConditions
return valueCallback.getValue(
0f, 0f, null, null, getProgress(), getProgress(), getProgress());
}
@Override A getValue(Keyframe<K> keyframe, float keyframeProgress) {
return getValue();
}
}