LottieVectorImageController QML Type | Qt Lottie Animation | Qt 6.12.0
Description: Provides animation control for a VectorImage that is displaying a Lottie file.
Keywords: qmltype

- Qt 6.12
- Qt Lottie Animation
- QML Types
- LottieVectorImageController
- Qt Lottie Animation | Commercial or GPLv3

# 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: | QtObject

- List of all members, including inherited members

## Properties

- currentFrame : real
- endFrame : real
- frameRate : real
- startFrame : real
- target : VectorImage

## Methods

- void gotoAndPlay(real frame)
- void gotoAndStop(real frame)
- 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.

### 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.

### void gotoAndStop(real frame)

Moves the playback to Lottie frame number frame and pauses it.

frame will be clamped between startFrame and endFrame.

### 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.