Samsung / rlottie

A platform independent standalone library that plays Lottie Animation.
Other
1.15k stars 223 forks source link

Fix one frame missing #529

Closed mmaciola closed 1 year ago

mmaciola commented 1 year ago

As mStartFrame and mEndFrame was counted from 0 and totalFrame() was calculated as a difference, there were always one frame missing and the animation rescaled. This patch adds one to the total frames count. As there is 0.01 subtracted (copied from android implementation, needed for some resources where frame no is non-whole number), added +2, not +1. It fixes the problem for all tested resources- requested and all in example/resource.

issue: #527

mmaciola commented 1 year ago

@JSUYA Thanks for review. I have force pushed a change. I changed the condition < to <= so no need for +2 but +1 and I added lround as long type is used, not float as in android implementation.

mmaciola commented 1 year ago

As lround(), no need for - 0.01f