lottianimation: fix incorrect animation in time stretch. 89/192389/4
authorHermet Park <hermetpark@gmail.com>
Mon, 5 Nov 2018 08:04:07 +0000 (17:04 +0900)
committerHermet Park <chuneon.park@samsung.com>
Mon, 5 Nov 2018 08:48:54 +0000 (08:48 +0000)
Instead of applying startFrame at frameAtPos()
but applied it at update() in generic way.

This change could make apis useful at both raw frame control
and normalized frame controls.

This fixes "cue" animation sample.

Change-Id: I0adfd73410291cdee95455b18ef8720482c81090

src/lottie/lottieanimation.cpp
src/lottie/lottiemodel.h

index f0086a6..2e9cd17 100644 (file)
@@ -39,6 +39,8 @@ const std::vector<LOTNode *> &AnimationImpl::renderList(size_t frameNo, const VS
 
 bool AnimationImpl::update(size_t frameNo, const VSize &size)
 {
+   frameNo += mModel->startFrame();
+
    if (frameNo > mModel->endFrame())
        frameNo = mModel->endFrame();
 
index d0a2e4c..3550b21 100644 (file)
@@ -333,8 +333,7 @@ public:
     size_t frameAtPos(double pos) const {
         if (pos < 0) pos = 0;
         if (pos > 1) pos = 1;
-        return isStatic() ? startFrame() :
-                            startFrame() + pos * frameDuration();
+        return isStatic() ? 0 : pos * frameDuration();
     }
     long frameAtTime(double timeInSec) const {
         return isStatic() ? startFrame() : frameAtPos(timeInSec / duration());