Package com.airbnb.lottie.value
Class LottieValueCallback<T>
- java.lang.Object
-
- com.airbnb.lottie.value.LottieValueCallback<T>
-
- Direct Known Subclasses:
LottieInterpolatedFloatValue,LottieInterpolatedIntegerValue,LottieInterpolatedPointValue,LottieRelativeFloatValueCallback,LottieRelativeIntegerValueCallback,LottieRelativePointValueCallback
public class LottieValueCallback<T> extends Object
Allows you to set a callback on a resolvedKeyPathto modify its animation values at runtime. If your dynamic property does the following, you must callLottieAnimationView.invalidate()orLottieDrawable.invalidateSelf()each time you want to update this value. 1. Usecom.airbnb.lottie.RenderMode.SOFTWARE2. Rendering a static image (the animation is either paused or there are no values changing within the animation itself) When using software rendering, Lottie caches the internal rendering bitmap. Whenever the animation changes internally, Lottie knows to invalidate the bitmap and re-render it on the next frame. If the animation never changes but your dynamic property does outside of Lottie, Lottie must be notified that it changed in order to set the bitmap as dirty and re-render it on the next frame.
-
-
Field Summary
Fields Modifier and Type Field Description protected TvalueThis can be set withsetValue(Object)to use a value instead of deferring to the callback.
-
Constructor Summary
Constructors Constructor Description LottieValueCallback()LottieValueCallback(T staticValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetValue(LottieFrameInfo<T> frameInfo)Override this if you haven't set a static value in the constructor or with setValue.TgetValueInternal(float startFrame, float endFrame, T startValue, T endValue, float linearKeyframeProgress, float interpolatedKeyframeProgress, float overallProgress)voidsetAnimation(BaseKeyframeAnimation<?,?> animation)voidsetValue(T value)
-
-
-
Field Detail
-
value
@Nullable protected T value
This can be set withsetValue(Object)to use a value instead of deferring to the callback.
-
-
Constructor Detail
-
LottieValueCallback
public LottieValueCallback()
-
LottieValueCallback
public LottieValueCallback(@Nullable T staticValue)
-
-
Method Detail
-
getValue
@Nullable public T getValue(LottieFrameInfo<T> frameInfo)
Override this if you haven't set a static value in the constructor or with setValue.Return null to resort to the default value. Refer to the javadoc for this class for a special case that requires manual invalidation each time you want to return something different from this method.
-
setValue
public final void setValue(@Nullable T value)
-
getValueInternal
@Nullable public final T getValueInternal(float startFrame, float endFrame, T startValue, T endValue, float linearKeyframeProgress, float interpolatedKeyframeProgress, float overallProgress)
-
setAnimation
public final void setAnimation(@Nullable BaseKeyframeAnimation<?,?> animation)
-
-