thorvg_python.animation.lottie¶
Classes¶
LottieAnimation Extension API |
Module Contents¶
-
class thorvg_python.animation.lottie.LottieAnimation(engine: thorvg_python.engine.Engine, animation: thorvg_python.base.AnimationPointer | None =
None)¶ Bases:
thorvg_python.animation.AnimationLottieAnimation Extension API
A module for manipulation of the scene tree
This module helps to control the scene tree.
- engine¶
- thorvg_lib¶
- new() thorvg_python.base.AnimationPointer¶
Creates a new LottieAnimation object.
Added in version 0.15.
- gen_slot(slot: str) int¶
Generates a new slot from the given slot data.
- Parameters:¶
- slot : str¶
The Lottie slot data in JSON format.
- Returns:¶
The generated slot ID when successful, 0 otherwise.
- Return type:¶
int
Added in version 1.0.
- apply_slot(_id: int) thorvg_python.base.Result¶
Applies a previously generated slot to the animation.
- Parameters:¶
- _id : int¶
The ID of the slot to apply, or 0 to reset all slots.
- Returns:¶
Result.INSUFFICIENT_CONDITION In case the animation is not loaded.
Result.INVALID_ARGUMENT When the given
_idis invalidResult.NOT_SUPPORTED The Lottie Animation is not supported.
- Return type:¶
Added in version 1.0.
- del_slot(_id: int) thorvg_python.base.Result¶
Deletes a previously generated slot.
- Parameters:¶
- _id: int¶
The ID of the slot to delete.
- Returns:¶
Result.INSUFFICIENT_CONDITION In case the animation is not loaded or the slot ID is invalid.
Result.NOT_SUPPORTED The Lottie Animation is not supported.
- Return type:¶
Note
This function should be paired with gen.
See also
LottieAnimation.gen_slot()
Added in version 1.0.
- set_marker(marker: str) thorvg_python.base.Result¶
Specifies a segment by marker.
- Parameters:¶
- marker : str¶
The name of the segment marker.
- Returns:¶
Result.INSUFFICIENT_CONDITION In case the animation is not loaded.
Result.INVALID_ARGUMENT When the given
markeris invalid.Result.NOT_SUPPORTED The Lottie Animation is not supported.
- Return type:¶
Note
Experimental API
- get_markers_cnt() tuple[thorvg_python.base.Result, int]¶
Gets the marker count of the animation.
- Returns:¶
Result.INVALID_ARGUMENT In case a
Noneis passed as the argument.- Return type:¶
- Returns:¶
The count value of the markers.
- Return type:¶
int
Note
Experimental API
- get_marker(idx: int) tuple[thorvg_python.base.Result, str | None]¶
Gets the marker name by a given index.
- Parameters:¶
- idx : int¶
The index of the animation marker, starts from 0.
- Returns:¶
Result.INVALID_ARGUMENT In case
Noneis passed as the argument oridxis out of range.- Rtyle:¶
Result
- Returns:¶
The name of marker when succeed.
- Return type:¶
Optional[str]
Note
Experimental API
- tween(_from: float, to: float, progress: float) thorvg_python.base.Result¶
Interpolates between two frames over a specified duration.
This method performs tweening, a process of generating intermediate frame between
_fromandtobased on the givenprogress.- Parameters:¶
- Returns:¶
TVG_RESULT_INSUFFICIENT_CONDITION In case the animation is not loaded.
- Return type:¶
Added in version 1.0.
- assign(layer: str, ix: int, var: str, val: float) thorvg_python.base.Result¶
Updates the value of an expression variable for a specific layer.
- Parameters:¶
- Returns:¶
Result.INSUFFICIENT_CONDITION If the animation is not loaded.
Result.INVALID_ARGUMENT When the given parameter is invalid.
Result.NOT_SUPPORTED When neither the layer nor the property is found in the current animation.
- Return type:¶
Note
Experimental API
- set_quality(value: int) thorvg_python.base.Result¶
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.
- Parameters:¶
- value : int¶
The quality level (0-100). 0 represents lowest quality/best performance, 100 represents highest quality/lowest performance, default is 50.
- Returns:¶
Result.INSUFFICIENT_CONDITION If the animation is not loaded.
Result.INVALID_ARGUMENT An invalid AnimationPointer.
- Return type:¶
Note
This option is used as a hint; its behavior heavily depends on the render backend.
Added in version 1.0.