From 9328482600d3ad2fc92b0055afe2123801f2c608 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Wed, 14 Nov 2018 15:57:02 +0900 Subject: [PATCH] lottie: fix position property animation along path. Change-Id: I5b30f96a0e8358d2f6b75685ad9025dcdd4dee60 --- src/lottie/lottiemodel.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index 05c888c..b3dba60 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -151,8 +151,14 @@ struct LOTKeyFrameValue VPointF value(float t) const { if (mPathKeyFrame) { - return VBezier::fromPoints(mStartValue, mStartValue + mOutTangent, - mEndValue + mInTangent, mEndValue).pointAt(t); + /* + * position along the path calcualated + * using bezier at progress length (t * bezlen) + */ + VBezier b = VBezier::fromPoints(mStartValue, mStartValue + mOutTangent, + mEndValue + mInTangent, mEndValue); + return b.pointAt(b.tAtLength(t * b.length())); + } else { return lerp(mStartValue, mEndValue, t); } -- 2.34.1