Package com.airbnb.lottie.utils
Class LottieValueAnimator
- java.lang.Object
-
- android.animation.Animator
-
- android.animation.ValueAnimator
-
- com.airbnb.lottie.utils.BaseLottieAnimator
-
- com.airbnb.lottie.utils.LottieValueAnimator
-
- All Implemented Interfaces:
Choreographer.FrameCallback,java.lang.Cloneable
public class LottieValueAnimator extends BaseLottieAnimator implements Choreographer.FrameCallback
This is a slightly modifiedValueAnimatorthat allows us to update start and end values easily optimizing for the fact that we know that it's a value animator with 2 floats.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class android.animation.ValueAnimator
ValueAnimator.AnimatorUpdateListener
-
Nested classes/interfaces inherited from class android.animation.Animator
Animator.AnimatorListener, Animator.AnimatorPauseListener
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanrunning-
Fields inherited from class android.animation.ValueAnimator
INFINITE, RESTART, REVERSE
-
Fields inherited from class android.animation.Animator
DURATION_INFINITE
-
-
Constructor Summary
Constructors Constructor Description LottieValueAnimator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()voidclearComposition()voiddoFrame(long frameTimeNanos)voidendAnimation()floatgetAnimatedFraction()Returns the current value of the currently playing animation taking into account direction, min and max frames.java.lang.ObjectgetAnimatedValue()Returns a float representing the current value of the animation from 0 to 1 regardless of the animation speed, direction, or min and max frames.floatgetAnimatedValueAbsolute()Returns the current value of the animation from 0 to 1 regardless of the animation speed, direction, or min and max frames.longgetDuration()floatgetFrame()floatgetMaxFrame()floatgetMinFrame()floatgetSpeed()Returns the current speed.booleanisRunning()voidpauseAnimation()voidplayAnimation()protected voidpostFrameCallback()protected voidremoveFrameCallback()protected voidremoveFrameCallback(boolean stopRunning)voidresumeAnimation()voidreverseAnimationSpeed()voidsetComposition(LottieComposition composition)voidsetFrame(float frame)voidsetMaxFrame(float maxFrame)voidsetMinAndMaxFrames(float minFrame, float maxFrame)voidsetMinFrame(int minFrame)voidsetRepeatMode(int value)voidsetSpeed(float speed)-
Methods inherited from class com.airbnb.lottie.utils.BaseLottieAnimator
addListener, addUpdateListener, getStartDelay, removeAllListeners, removeAllUpdateListeners, removeListener, removeUpdateListener, setDuration, setInterpolator, setStartDelay
-
Methods inherited from class android.animation.ValueAnimator
areAnimatorsEnabled, clone, end, getAnimatedValue, getCurrentPlayTime, getFrameDelay, getInterpolator, getRepeatCount, getRepeatMode, getTotalDuration, getValues, isStarted, ofArgb, ofFloat, ofInt, ofObject, ofPropertyValuesHolder, pause, resume, reverse, setCurrentFraction, setCurrentPlayTime, setEvaluator, setFloatValues, setFrameDelay, setIntValues, setObjectValues, setRepeatCount, setValues, start, toString
-
Methods inherited from class android.animation.Animator
addPauseListener, getListeners, isPaused, removePauseListener, setTarget, setupEndValues, setupStartValues
-
-
-
-
Method Detail
-
getAnimatedValue
public java.lang.Object getAnimatedValue()
Returns a float representing the current value of the animation from 0 to 1 regardless of the animation speed, direction, or min and max frames.- Overrides:
getAnimatedValuein classValueAnimator
-
getAnimatedValueAbsolute
public float getAnimatedValueAbsolute()
Returns the current value of the animation from 0 to 1 regardless of the animation speed, direction, or min and max frames.
-
getAnimatedFraction
public float getAnimatedFraction()
Returns the current value of the currently playing animation taking into account direction, min and max frames.- Overrides:
getAnimatedFractionin classValueAnimator
-
getDuration
public long getDuration()
- Overrides:
getDurationin classValueAnimator
-
getFrame
public float getFrame()
-
isRunning
public boolean isRunning()
- Overrides:
isRunningin classValueAnimator
-
doFrame
public void doFrame(long frameTimeNanos)
- Specified by:
doFramein interfaceChoreographer.FrameCallback
-
clearComposition
public void clearComposition()
-
setComposition
public void setComposition(LottieComposition composition)
-
setFrame
public void setFrame(float frame)
-
setMinFrame
public void setMinFrame(int minFrame)
-
setMaxFrame
public void setMaxFrame(float maxFrame)
-
setMinAndMaxFrames
public void setMinAndMaxFrames(float minFrame, float maxFrame)
-
reverseAnimationSpeed
public void reverseAnimationSpeed()
-
setSpeed
public void setSpeed(float speed)
-
getSpeed
public float getSpeed()
Returns the current speed. This will be affected by repeat mode REVERSE.
-
setRepeatMode
public void setRepeatMode(int value)
- Overrides:
setRepeatModein classValueAnimator
-
playAnimation
@MainThread public void playAnimation()
-
endAnimation
@MainThread public void endAnimation()
-
pauseAnimation
@MainThread public void pauseAnimation()
-
resumeAnimation
@MainThread public void resumeAnimation()
-
cancel
@MainThread public void cancel()
- Overrides:
cancelin classValueAnimator
-
getMinFrame
public float getMinFrame()
-
getMaxFrame
public float getMaxFrame()
-
postFrameCallback
protected void postFrameCallback()
-
removeFrameCallback
@MainThread protected void removeFrameCallback()
-
removeFrameCallback
@MainThread protected void removeFrameCallback(boolean stopRunning)
-
-