![]() |
ThorVG v1.0
|
The LottieAnimation class enables control of advanced Lottie features. More...
#include <thorvg_lottie.h>


Public Member Functions | |
| Result | segment (const char *marker) noexcept |
| Specifies a segment by marker. | |
| Result | tween (float from, float to, float progress) noexcept |
| Interpolates between two frames over a specified duration. | |
| uint32_t | markersCnt () noexcept |
| Gets the marker count of the animation. | |
| const char * | marker (uint32_t idx) noexcept |
| Gets the marker name by a given index. | |
| Result | assign (const char *layer, uint32_t ix, const char *var, float val) |
| Updates the value of an expression variable for a specific layer. | |
| uint32_t | gen (const char *slot) noexcept |
| Creates a new slot based on the given Lottie slot data. | |
| Result | apply (uint32_t id) noexcept |
| Applies a previously generated slot to the animation. | |
| Result | del (uint32_t id) noexcept |
| Deletes a previously generated slot. | |
| Result | quality (uint8_t value) noexcept |
| Sets the quality level for Lottie effects. | |
Public Member Functions inherited from Animation | |
| Result | frame (float no) noexcept |
| Specifies the current frame in the animation. | |
| Picture * | picture () const noexcept |
| Retrieves a picture instance associated with this animation instance. | |
| float | curFrame () const noexcept |
| Retrieves the current frame number of the animation. | |
| float | totalFrame () const noexcept |
| Retrieves the total number of frames in the animation. | |
| float | duration () const noexcept |
| Retrieves the duration of the animation in seconds. | |
| Result | segment (float begin, float end) noexcept |
| Specifies the playback segment of the animation. | |
| Result | segment (float *begin, float *end=nullptr) noexcept |
| Gets the current segment range information. | |
Static Public Member Functions | |
| static LottieAnimation * | gen () noexcept |
| Creates a new LottieAnimation object. | |
Static Public Member Functions inherited from Animation | |
| static Animation * | gen () noexcept |
| Creates a new Animation object. | |
The LottieAnimation class enables control of advanced Lottie features.
This class extends the Animation and has additional interfaces.
|
noexcept |
Applies a previously generated slot to the animation.
This function applies the animation parameters defined by a slot. If the provided slot ID is 0, all previously applied slots will be reset.
| [in] | id | The ID of the slot to apply. Use 0 to reset all slots. |
| Result::InvalidArguments | If the animation is not loaded or the slot ID is invalid. |
| Result assign | ( | const char * | layer, |
| uint32_t | ix, | ||
| const char * | var, | ||
| float | val | ||
| ) |
Updates the value of an expression variable for a specific layer.
This function sets the value of a specified expression variable within a particular layer. It is useful for dynamically changing the properties of a layer at runtime.
| [in] | layer | The name of the layer containing the variable to be updated. |
| [in] | ix | The property index of the variable within the layer. |
| [in] | var | The name of the variable to be updated. |
| [in] | val | The new value to assign to the variable. |
| Result::InsufficientCondition | If the animation is not loaded. |
| Result::InvalidArguments | When the given parameter is invalid. |
| Result::NonSupport | When neither the layer nor the property is found in the current animation. |
|
noexcept |
Deletes a previously generated slot.
This function removes a slot by its ID.
| [in] | id | The ID of the slot to delete. Retrieve the ID from gen(). |
| Result::InvalidArguments | If the animation is not loaded or the slot ID is invalid. |
|
staticnoexcept |
|
noexcept |
Creates a new slot based on the given Lottie slot data.
This function parses the provided JSON-formatted slot data and generates a new slot for animation control. The returned slot ID can be used to apply or delete the slot later.
| [in] | slot | A JSON string representing the Lottie slot data. |
0 if the slot generation fails.
|
noexcept |
Gets the marker name by a given index.
| [in] | idx | The index of the animation marker, starts from 0. |
| The | name of marker when succeed, nullptr otherwise. |
|
noexcept |
Gets the marker count of the animation.
| The | count of the markers, zero if there is no marker. |
|
noexcept |
Sets the quality level for Lottie effects.
This function controls the rendering quality of effects like blur, shadows, etc. Lower values prioritize performance while higher values prioritize quality.
| [in] | value | The quality level (0-100). 0 represents lowest quality/best performance, 100 represents highest quality/lowest performance, default is 50. |
| Result::InsufficientCondition | If the animation is not loaded. |
|
noexcept |
Specifies a segment by marker.
Markers are used to control animation playback by specifying start and end points, eliminating the need to know the exact frame numbers. Generally, markers are designated at the design level, meaning the callers must know the marker name in advance to use it.
| [in] | marker | The name of the segment marker. |
| Result::InsufficientCondition | If the animation is not loaded. |
| Result::NonSupport | When it's not animatable. |
marker is specified, the previously set segment will be disregarded. nullptr to reset the specified segment.
|
noexcept |
Interpolates between two frames over a specified duration.
This method performs tweening, a process of generating intermediate frame between from and to based on the given progress.
| [in] | from | The start frame number of the interpolation. |
| [in] | to | The end frame number of the interpolation. |
| [in] | progress | The current progress of the interpolation (range: 0.0 to 1.0). |
| Result::InsufficientCondition | In case the animation is not loaded. |