lottie/vector: don't use startFrame() of a layer when it has time remap. 64/196864/2 accepted/tizen/unified/20190111.055210 submit/tizen/20190110.045317
authorsubhransu mohanty <sub.mohanty@samsung.com>
Mon, 7 Jan 2019 05:07:02 +0000 (14:07 +0900)
committerHermet Park <chuneon.park@samsung.com>
Tue, 8 Jan 2019 05:57:59 +0000 (05:57 +0000)
Change-Id: I62230a2f5d9447bf7fa7ff3c9ebeed7aaa90dfa3

src/lottie/lottieitem.cpp
src/lottie/lottiemodel.h

index 11a6489..667142c 100644 (file)
@@ -591,10 +591,9 @@ void LOTCompLayerItem::updateContent()
     if (mClipper && flag().testFlag(DirtyFlagBit::Matrix)) {
         mClipper->update(combinedMatrix());
     }
-
+    int mappedFrame = mLayerData->timeRemap(frameNo());
     for (const auto &layer : mLayers) {
-        layer->update( mLayerData->timeRemap(frameNo()) - mLayerData->startFrame(),
-                       combinedMatrix(), combinedAlpha());
+        layer->update( mappedFrame, combinedMatrix(), combinedAlpha());
     }
 }
 
index 47faccf..16a75d5 100644 (file)
@@ -441,7 +441,12 @@ public:
  */
 inline int LOTLayerData::timeRemap(int frameNo) const
 {
-    frameNo = mTimeRemap.isStatic() ? frameNo :
+    /*
+     * only consider startFrame() when there is no timeRemap.
+     * when a layer has timeremap bodymovin updates the startFrame()
+     * of all child layer so we don't have to take care of it.
+     */
+    frameNo = mTimeRemap.isStatic() ? frameNo - startFrame():
               mCompRef->frameAtTime(mTimeRemap.value(frameNo));
     /* Apply time streatch if it has any.
      * Time streatch is just a factor by which the animation will speedup or slow