From e4330f7089aa513482baf5e56ea1283d24be6490 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 13 Sep 2023 17:56:10 +0900 Subject: [PATCH] loader/lottie: implemented missing hold interpolation. path/colorstop has been missed to implement that feature. --- src/loaders/lottie/tvgLottieProperty.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/loaders/lottie/tvgLottieProperty.h b/src/loaders/lottie/tvgLottieProperty.h index 06203f2a..dcef08b9 100644 --- a/src/loaders/lottie/tvgLottieProperty.h +++ b/src/loaders/lottie/tvgLottieProperty.h @@ -302,6 +302,12 @@ struct LottiePathSet auto t = float(frameNo - pframe->no) / float(frame->no - pframe->no); if (pframe->interpolator) t = pframe->interpolator->progress(t); + if (pframe->hold) { + if (t < 1.0f) copy(pframe->value, pts); + else copy(frame->value, pts); + return true; + } + auto s = pframe->value.pts; auto e = frame->value.pts; @@ -390,6 +396,11 @@ struct LottieColorStop auto t = float(frameNo - pframe->no) / float(frame->no - pframe->no); if (pframe->interpolator) t = pframe->interpolator->progress(t); + if (pframe->hold) { + if (t < 1.0f) fill->colorStops(pframe->value.data, count); + else fill->colorStops(frame->value.data, count); + } + auto s = pframe->value.data; auto e = frame->value.data;