From cb03e6e947be74e4210147578e261ea5e894d558 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Thu, 30 Aug 2018 14:00:47 +0900 Subject: [PATCH] lottie: fixed proper handling of offset property in trim object. The offset property is in degree and wraps after 360 degree to 0. so normalize the offset property to [0 - 1] and pass it to pathmesure object. Change-Id: Ifd56f0926c1971dd5dd549787dcf5e5c35ed875a --- src/lottie/lottiemodel.h | 2 +- src/vector/vpathmesure.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index 85e5077..61e0d9b 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -656,7 +656,7 @@ public: {visitor->visit(this);} float start(int frameNo) const {return mStart.value(frameNo)/100.0f;} float end(int frameNo) const {return mEnd.value(frameNo)/100.0f;} - float offset(int frameNo) const {return mOffset.value(frameNo);} + float offset(int frameNo) const {return mOffset.value(frameNo)/ 360.0f;} LOTTrimData::TrimType type() const {return mTrimType;} public: LOTAnimatable mStart{0}; diff --git a/src/vector/vpathmesure.cpp b/src/vector/vpathmesure.cpp index 05c61b6..d588dc6 100644 --- a/src/vector/vpathmesure.cpp +++ b/src/vector/vpathmesure.cpp @@ -26,7 +26,7 @@ VPath VPathMesure::trim(const VPath &path) return oneSegment(length * mStart, length * mEnd, path); } else { float length = path.length(); - float offset = fmod(mOffset, length); + float offset = length * mOffset; float start = length * mStart; float end = length * mEnd; start += offset; -- 2.34.1