diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index 3e043085..59a9c41a 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -539,8 +539,8 @@ class Composition : public Object { { return long(frameAtPos(timeInSec / duration())); } - size_t totalFrame() const { return mEndFrame - mStartFrame; } - long frameDuration() const { return mEndFrame - mStartFrame - 1; } + size_t totalFrame() const { return mEndFrame - mStartFrame + 2; } + long frameDuration() const { return mEndFrame - mStartFrame; } float frameRate() const { return mFrameRate; } size_t startFrame() const { return mStartFrame; } size_t endFrame() const { return mEndFrame; } diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp index 83be17e3..799480be 100644 --- a/src/lottie/lottieparser.cpp +++ b/src/lottie/lottieparser.cpp @@ -667,7 +667,7 @@ void LottieParserImpl::parseComposition() } else if (0 == strcmp(key, "ip")) { comp->mStartFrame = GetDouble(); } else if (0 == strcmp(key, "op")) { - comp->mEndFrame = GetDouble(); + comp->mEndFrame = GetDouble() - 0.01f; } else if (0 == strcmp(key, "fr")) { comp->mFrameRate = GetDouble(); } else if (0 == strcmp(key, "assets")) { @@ -699,7 +699,7 @@ void LottieParserImpl::parseComposition() resolveLayerRefs(); comp->setStatic(comp->mRootLayer->isStatic()); comp->mRootLayer->mInFrame = comp->mStartFrame; - comp->mRootLayer->mOutFrame = comp->mEndFrame; + comp->mRootLayer->mOutFrame = comp->mEndFrame + 2; mComposition = sharedComposition; }