lottie: fixed proper handling of offset property in trim object. 67/187967/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Thu, 30 Aug 2018 05:00:47 +0000 (14:00 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Thu, 30 Aug 2018 05:00:47 +0000 (14:00 +0900)
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
src/vector/vpathmesure.cpp

index 85e5077..61e0d9b 100644 (file)
@@ -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<float>             mStart{0};
index 05c61b6..d588dc6 100644 (file)
@@ -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;