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.
This commit is contained in:
Jinny You 2024-09-19 12:47:15 +09:00 committed by Hermet Park
parent ab54345d9a
commit e8665840db
2 changed files with 2 additions and 1 deletions

View file

@ -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->fill(doc.color.rgb[0], doc.color.rgb[1], doc.color.rgb[2]);
shape->translate(cursor.x, cursor.y); shape->translate(cursor.x, cursor.y);
shape->opacity(255);
if (doc.stroke.render) { if (doc.stroke.render) {
shape->stroke(StrokeJoin::Round); shape->stroke(StrokeJoin::Round);

View file

@ -180,7 +180,7 @@ struct LottieTextRange
LottieFloat maxAmount = 0.0f; LottieFloat maxAmount = 0.0f;
LottieFloat smoothness = 0.0f; LottieFloat smoothness = 0.0f;
LottieFloat start = 0.0f; LottieFloat start = 0.0f;
LottieFloat end = 0.0f; LottieFloat end = FLT_MAX;
Based based = Chars; Based based = Chars;
Shape shape = Square; Shape shape = Square;
Unit rangeUnit = Percent; Unit rangeUnit = Percent;