thorvg_lottie.h

namespace tvg
class LottieAnimation : public tvg::Animation
#include <thorvg_lottie.h>

The LottieAnimation class enables control of advanced Lottie features.

This class extends the Animation and has additional interfaces.

See also

Animation

Note

Experimental API

Public Functions

~LottieAnimation()
Result override(const char *slot) noexcept

Override Lottie properties using slot data.

Note

Experimental API

Parameters:

slot -- [in] The Lottie slot data in JSON format to override, or nullptr to reset.

Return values:
  • Result::Success -- When succeed.

  • Result::InsufficientCondition -- In case the animation is not loaded.

  • Result::InvalidArguments -- When the given parameter is invalid.

Result segment(const char *marker) 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.

Note

If a marker is specified, the previously set segment will be disregarded.

Note

Set nullptr to reset the specified segment.

Note

Experimental API

Parameters:

marker -- [in] The name of the segment marker.

Return values:
  • Result::Success -- When successful.

  • Result::InsufficientCondition -- If the animation is not loaded.

  • Result::InvalidArguments -- When the given parameter is invalid.

  • Result::NonSupport -- When it's not animatable.

uint32_t markersCnt() noexcept

Gets the marker count of the animation.

Note

Experimental API

Return values:

The -- count of the markers, zero if there is no marker.

const char *marker(uint32_t idx) noexcept

Gets the marker name by a given index.

Note

Experimental API

Parameters:

idx -- [in] The index of the animation marker, starts from 0.

Return values:

The -- name of marker when succeed, nullptr otherwise.

Public Static Functions

static std::unique_ptr<LottieAnimation> gen() noexcept

Creates a new LottieAnimation object.

Note

Experimental API

Returns:

A new LottieAnimation object.