Interface ILottieView
interface ILottieView
Extends IView
ILottieView interface defines methods for configuring lottie animations.
Methods
setSource()
Sets the source of the lottie animation to be played. Starts playing lottie animation after setting source if autoPlay is true.voidsetSource(LottieSourceTypesourceType,stringsource)
Parameters
sourceType
LottieSourceType — Required
LottieSourceType The type of the source to be played.
source
string — Required
The string source of the lottie animation, which can be a JSON string or a JSON file path.
Throws
InvalidLottieSourceError— if the source is invalid or the assets directory set using setAssetsDir API is invalid.
setAssetsDir()
Sets the directory path where the lottie animation assets are stored.voidsetAssetsDir(stringassetDirectory)
Parameters
assetDirectory
string — Required
The string directory path where the lottie animation assets are stored.
getProgress()
float getProgress()
Returns the current progress of the lottie animation, which is in the range 0.0 to 1.0.
Returns
float
float value representing the progress of the lottie animation.
setProgress()
Sets the playback progress of the lottie animation, which determines the current frame to be displayed. The value of progress should be in the range {0.0, 1.0}. If not explicitly set, the default value is set to 0.0.voidsetProgress(floatprogress)
Parameters
progress
float — Required
A float value representing the progress of the lottie animation, where 0.0 is the start
and 1.0 is the end.
Throws
OutOfBoundsError— if the provided progress value is outside the valid range {0.0, 1.0}.
setDuration()
Sets the duration of the lottie animation. When called, the speed set earlier is updated according to duration set here.voidsetDuration(com.amazon.apmf.MonotonicDurationduration)
Parameters
duration
com.amazon.apmf.MonotonicDuration — Required
{MonotonicDuration} value representing duration of the lottie animation.
setSpeed()
Sets the playback speed of the lottie animation relative to the normal speed. When called, the duration set earlier is updated according to speed set here. Recommended to keep the precision upto 6 decimal places. For negative values of speed, the lottie animation plays in reverse (endFrame to startFrame). If not explicitly set, the default value is 1.0.voidsetSpeed(floatspeed)
Parameters
speed
float — Required
A float value representing the playback speed of the lottie animation relative to normal speed.
setLoop()
Sets whether the lottie animation should loop. If not explicitly set, the default value is set to true.voidsetLoop(boolisLoop)
Parameters
isLoop
bool — Required
A boolean value indicating whether the lottie animation should loop.
setResizeMode()
Sets the resize mode of the lottie animation. If not explicitly set, the default ResizeMode is set to CONTAIN. This method allows you to specify how the lottie animation should be resized within the View. If called while lottie animation is playing, it updates the resize mode immediately.voidsetResizeMode(LottieResizeModeresizeMode)
Parameters
resizeMode
LottieResizeMode — Required
LottieResizeMode representing the resize mode to be applied to the animation.
setAutoPlay()
Sets whether the lottie animation should autoplay. If not explicitly set, the default value is set to false.voidsetAutoPlay(boolisAutoPlay)
Parameters
isAutoPlay
bool — Required
A boolean value indicating whether the lottie animation should autoplay.
setLottieAnimationListener()
Registers a listener to receive notifications when events such as animation begin and end occur.com.amazon.apmf.ISubscription*setLottieAnimationListener(ILottieAnimationListener*animationListener)
Parameters
animationListener
ILottieAnimationListener* — Required
Pointer to an instance of the ILottieAnimationListener
to be added as a Lottie animation listener.
Returns
com.amazon.apmf.ISubscription*
An ID specific to the registered listener, which can be used to identify or manage the listener.
setStartFrame()
Sets the start frame of the lottie animation. startFrame ranges from 0 to the last frame of lottie animation. If not explicitly set, the start frame will be first frame by default. If value provided is greater than last frame of animation, startFrame is set to last frame of animation.voidsetStartFrame(u32frame)
Parameters
frame
u32 — Required
Integer value representing the starting frame of the lottie animation.
Throws
InvalidArgumentError— if the startFrame is outside valid frame bounds.
setEndFrame()
Sets the end frame of the lottie animation. endFrame ranges from 0 to last frame of lottie animation. If not explicitly set, the end frame would be the last frame by default. If value provided is greater than last frame of animation, endFrame is set to last frame of animation.voidsetEndFrame(u32frame)
Parameters
frame
u32 — Required
Integer value representing the ending frame of the lottie animation.
Throws
InvalidArgumentError— if the endFrame is outside valid frame bounds.
play()
void play()
Starts playing the lottie animation.
Calling this api will not have any effect if the lottie animation is already playing.
pause()
void pause()
Pauses the lottie animation at its current frame.
resume()
void resume()
Resumes the lottie animation from its current paused state.
reset()
void reset()
Resets the lottie animation to its initial state.
To play again after calling this api, play() needs to be explicitly called even if autoPlay was set.

