lottie: handle time remapping with zero value correctly

The time remapping logic had an issue where animations with zero value "tm"(Time Remap) were not being processed correctly.

This was happening because the previous implementation only applied time remapping when the value was non-zero. (A zero-value Time Remap should be applied, but is ignored)

The fix changes the default time remap value to `-1.0` (since frame values cannot be negative) and applies time remapping when the value is 0.0 or greater. This ensures that zero value time remapping is properly processed.
This commit is contained in:
Jinny You 2025-05-13 20:09:48 +09:00 committed by Hermet Park
parent 6e41b44ea1
commit 1e692f223c
2 changed files with 2 additions and 2 deletions

View file

@ -693,7 +693,7 @@ void LottieLayer::prepare(RGB24* color)
float LottieLayer::remap(LottieComposition* comp, float frameNo, LottieExpressions* exp)
{
if (timeRemap.frames || timeRemap.value) {
if (timeRemap.frames || timeRemap.value >= 0.0f) {
frameNo = comp->frameAtTime(timeRemap(frameNo, exp));
} else {
frameNo -= startFrame;

View file

@ -980,7 +980,7 @@ struct LottieLayer : LottieGroup
char* name = nullptr;
LottieLayer* parent = nullptr;
LottieFloat timeRemap = 0.0f;
LottieFloat timeRemap = -1.0f;
LottieLayer* comp = nullptr; //Precompositor, current layer is belonges.
LottieTransform* transform = nullptr;
Array<LottieMask*> masks;