mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
lottie: fix interpolation issue
Handled the case of different numbers of points in consecutive frames. This case can occur due to erroneous data or as a consequence of changing the path from closed to open and vice versa. @Issue: https://github.com/thorvg/thorvg/issues/2287
This commit is contained in:
parent
03e7c70524
commit
3a8ef78a36
1 changed files with 4 additions and 1 deletions
|
@ -544,7 +544,10 @@ struct LottiePathSet : LottieProperty
|
|||
else {
|
||||
frame = frames->data + _bsearch(frames, frameNo);
|
||||
if (mathEqual(frame->no, frameNo)) path = &frame->value;
|
||||
else {
|
||||
else if (frame->value.ptsCnt != (frame + 1)->value.ptsCnt) {
|
||||
path = &frame->value;
|
||||
TVGLOG("LOTTIE", "Different numbers of points in consecutive frames - interpolation omitted.");
|
||||
} else {
|
||||
t = (frameNo - frame->no) / ((frame + 1)->no - frame->no);
|
||||
if (frame->interpolator) t = frame->interpolator->progress(t);
|
||||
if (frame->hold) path = &(frame + ((t < 1.0f) ? 0 : 1))->value;
|
||||
|
|
Loading…
Add table
Reference in a new issue