rlottie icon indicating copy to clipboard operation
rlottie copied to clipboard

Simple moving circle not playing properly

Open mattbeghin opened this issue 1 year ago • 1 comments

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 avatar Aug 19 '23 23:08 mattbeghin

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

mattbeghin avatar Aug 21 '23 09:08 mattbeghin