LottieVectorImageController QML Type
Provides animation control for a VectorImage that is displaying a Lottie file. More...
| Import Statement: | import Qt.labs.lottieqt 1.0 |
| Since: | Qt 6.12 |
| Inherits: |
Properties
- currentFrame : real
- endFrame : real
- frameRate : real
- markers : list<string>
(since 6.13) - startFrame : real
- target : VectorImage
Methods
- void gotoAndPlay(real frame)
- bool gotoAndPlay(string markerName)
(since 6.13) - void gotoAndStop(real frame)
- bool gotoAndStop(string markerName)
(since 6.13) - void pause()
- void play()
- void start()
- void stop()
- void togglePause()
Detailed Description
VectorImage can display and play Lottie animations, but by itself it provides only rudimentary functionality for controlling the playback. LottieVectorImageController extends VectorImage with more powerful API for querying and controlling the animation.
LottieVectorImageController's target property specifies the VectorImage to be controlled. It is set by default if the LottieVectorImageController is created as a child or property of a VectorImage. When the VectorImage has loaded a Lottie file, and its status is Ready, the LottieVectorImageController's properties can be read and written, and its functions called, to control the playback.
Taken together with VectorImage, LottieVectorImageController mimics the API of the existing LottieAnimation item, so they are typically interchangeable with little effort. (The getDuration() function is not provided, since it can be trivially replaced by a simple expression using the endFrame, startFrame and optionally frameRate properties.)
See also VectorImage and qtlottieviewer Example.
Property Documentation
currentFrame : real [read-only]
The number of the currently displayed animation frame.
endFrame : real [read-only]
The animation's ending frame number ("out-frame"), as specified in the source file.
frameRate : real
This property holds the animation playback speed in frames per second.
When the vector image is loaded, this property is set to the frame rate value specified in the source file.
After loading, frameRate can be modified to change the playback speed. Assigning an empty value to it will reset it to the source file value.
markers : list<string> [read-only, since 6.13]
Names of the markers defined in the Lottie animation file. The list is available after the target VectorImage has loaded and is ready.
Markers can be used with gotoAndPlay() and gotoAndStop() to jump to a named position in the animation. If a marker has a non-zero duration, gotoAndPlay() will stop playback automatically at the end of the marked segment.
This property was introduced in Qt 6.13.
startFrame : real [read-only]
The animation's starting frame number ("in-frame"), as specified in the source file.
target : VectorImage
This property specifies the VectorImage to be controlled.
If the LottieVectorImageController is created as a child or property of a VectorImage, that will be the default target. Otherwise, the target must be set explicitly.
Method Documentation
void gotoAndPlay(real frame)
Moves the playback to Lottie frame number frame and plays it.
frame will be clamped between startFrame and endFrame.
[since 6.13] bool gotoAndPlay(string markerName)
Moves the playback to the frame that has a marker with the given markerName and plays it. If the marker has a non-zero duration, playback stops automatically at the end of the segment. Returns true if the marker was found, false otherwise.
This method was introduced in Qt 6.13.
void gotoAndStop(real frame)
Moves the playback to Lottie frame number frame and pauses it.
frame will be clamped between startFrame and endFrame.
[since 6.13] bool gotoAndStop(string markerName)
Moves the playback to the frame that has a marker with the given markerName and pauses it. Returns true if the marker was found, false otherwise.
This method was introduced in Qt 6.13.
void pause()
Pauses the playback.
void play()
Starts (un-pauses) the playback.
void start()
Restarts the playback from the startFrame.
void stop()
Resets the playback to the startFrame and pauses it.
void togglePause()
Toggles the target VectorImage between playing and paused modes.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.