From d70ddcd67cecceea650a4cb29915eacbfb2ede72 Mon Sep 17 00:00:00 2001 From: Jinny You Date: Thu, 19 Sep 2024 12:47:15 +0900 Subject: [PATCH] lottie/text: Fix incorrect text range without end condition Improving text render compatibility by fixing wrong Text Range. When lottie doesn't have `end` prop in the range, system must ignore condition regarding to `end`. The original logic unintentionally swaps `start` and `end` prop, because `end` is the zero in this case. Then the text range animation behaves the opposite. --- src/loaders/lottie/tvgLottieBuilder.cpp | 1 + src/loaders/lottie/tvgLottieModel.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 1b09af6f..d7aacd83 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -1053,6 +1053,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo) } shape->fill(doc.color.rgb[0], doc.color.rgb[1], doc.color.rgb[2]); shape->translate(cursor.x, cursor.y); + shape->opacity(255); if (doc.stroke.render) { shape->strokeJoin(StrokeJoin::Round); diff --git a/src/loaders/lottie/tvgLottieModel.h b/src/loaders/lottie/tvgLottieModel.h index 241159eb..b22727a1 100644 --- a/src/loaders/lottie/tvgLottieModel.h +++ b/src/loaders/lottie/tvgLottieModel.h @@ -180,7 +180,7 @@ struct LottieTextRange LottieFloat maxAmount = 0.0f; LottieFloat smoothness = 0.0f; LottieFloat start = 0.0f; - LottieFloat end = 0.0f; + LottieFloat end = FLT_MAX; Based based = Chars; Shape shape = Square; Unit rangeUnit = Percent;