1 #ifndef _THORVG_LOTTIE_H_ 2 #define _THORVG_LOTTIE_H_ 3 4 #include "thorvg.h" 5 6 namespace tvg 7 { 8 9 /** 10 * @class LottieAnimation 11 * 12 * @brief The LottieAnimation class enables control of advanced Lottie features. 13 * 14 * This class extends the Animation and has additional interfaces. 15 * 16 * @see Animation 17 * 18 * @since 0.15 19 */ 20 21 #include "../../lv_conf_internal.h" 22 #if LV_USE_THORVG_INTERNAL 23 class TVG_API LottieAnimation final : public Animation 24 { 25 public: 26 ~LottieAnimation(); 27 28 /** 29 * @brief Override Lottie properties using slot data. 30 * 31 * @param[in] slot The Lottie slot data in JSON format to override, or @c nullptr to reset. 32 * 33 * @retval Result::Success When succeed. 34 * @retval Result::InsufficientCondition In case the animation is not loaded. 35 * @retval Result::InvalidArguments When the given parameter is invalid. 36 * 37 * @note Experimental API 38 */ 39 Result override(const char* slot) noexcept; 40 41 /** 42 * @brief Specifies a segment by marker. 43 * 44 * Markers are used to control animation playback by specifying start and end points, 45 * eliminating the need to know the exact frame numbers. 46 * Generally, markers are designated at the design level, 47 * meaning the callers must know the marker name in advance to use it. 48 * 49 * @param[in] marker The name of the segment marker. 50 * 51 * @retval Result::Success When successful. 52 * @retval Result::InsufficientCondition If the animation is not loaded. 53 * @retval Result::InvalidArguments When the given parameter is invalid. 54 * @retval Result::NonSupport When it's not animatable. 55 * 56 * @note If a @c marker is specified, the previously set segment will be disregarded. 57 * @note Set @c nullptr to reset the specified segment. 58 * @see Animation::segment(float begin, float end) 59 * @note Experimental API 60 */ 61 Result segment(const char* marker) noexcept; 62 63 /** 64 * @brief Gets the marker count of the animation. 65 * 66 * @retval The count of the markers, zero if there is no marker. 67 * 68 * @see LottieAnimation::marker() 69 * @note Experimental API 70 */ 71 uint32_t markersCnt() noexcept; 72 73 /** 74 * @brief Gets the marker name by a given index. 75 * 76 * @param[in] idx The index of the animation marker, starts from 0. 77 * 78 * @retval The name of marker when succeed, @c nullptr otherwise. 79 * 80 * @see LottieAnimation::markersCnt() 81 * @note Experimental API 82 */ 83 const char* marker(uint32_t idx) noexcept; 84 85 /** 86 * @brief Creates a new LottieAnimation object. 87 * 88 * @return A new LottieAnimation object. 89 * 90 * @since 0.15 91 */ 92 static std::unique_ptr<LottieAnimation> gen() noexcept; 93 }; 94 95 } //namespace 96 97 #endif //_THORVG_LOTTIE_H_ 98 99 #endif /* LV_USE_THORVG_INTERNAL */ 100 101