Samsung / rlottie

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

Simple moving circle not playing properly #548

Open mattbeghin opened 1 year ago

mattbeghin commented 1 year ago

Sorry if I'm missing something stupid. I have a very simple file which rlottie is unable to play. It's a single shape layer with an ellipse, and with just two key frames to animate the position. It works fine in https://lottiefiles.github.io/lottie-docs/playground/json_editor/ With rlottie it plays first frame correctly then the ellipse goes to 0,0 instead of following the positions of the keyframes.

Any idea why this one doesn't work ?

simple moving ellispe.json.zip

mattbeghin commented 1 year ago

I could solve the issue, the problem is that the last keyframe end time is not set in LottieParserImpl::parseKeyFrame. The keyframe end time is set when parsing the next keyframe so last one is no set. Then KeyFrames::value(int frameNo) does this test: if (frames.back().end <= frameNo) return frames.back().value.end_; So it doesn't interpolate. I could solve the issue setting the keyframe end time to its start time when parsing. I will make a pull request