diff --git a/src/loaders/lottie/tvgLottieModel.cpp b/src/loaders/lottie/tvgLottieModel.cpp index b1a817a5..5fb1b89b 100644 --- a/src/loaders/lottie/tvgLottieModel.cpp +++ b/src/loaders/lottie/tvgLottieModel.cpp @@ -65,6 +65,7 @@ float LottieTextFollowPath::prepare(LottieMask* mask, float frameNo, float scale { this->mask = mask; Matrix m{1.0f / scale, 0.0f, 0.0f, 0.0f, 1.0f / scale, 0.0f, 0.0f, 0.0f, 1.0f}; + path.clear(); mask->pathset(frameNo, path, &m, tween, exps); pts = path.pts.data; @@ -109,10 +110,10 @@ Point LottieTextFollowPath::position(float lenSearched, float& angle) }; //beyond the curve - if (lenSearched > totalLen) { + if (lenSearched >= totalLen) { //shape is closed -> wrapping if (path.cmds.last() == PathCommand::Close) { - lenSearched -= totalLen; + while (lenSearched > totalLen) lenSearched -= totalLen; pts = path.pts.data; cmds = path.cmds.data; cmdsCnt = path.cmds.count; @@ -147,7 +148,7 @@ Point LottieTextFollowPath::position(float lenSearched, float& angle) while (cmdsCnt > 0) { auto dLen = length(); - if (currentLen + dLen <= lenSearched) { + if (currentLen + dLen < lenSearched) { shift(); currentLen += dLen; continue;