Skip to content

Commit

Permalink
fix: Duration in LottieRenderer rounds down milliseconds (#2808)
Browse files Browse the repository at this point in the history
Duration in LottieRenderer rounds down milliseconds and causes two problems:

    Speeds up when rendering a Lottie animation that duration is non-integer seconds.
    When rendering Lottie animation that duration shorter than one second, duration of the animation will detect as zero seconds and cause the hole game freeze at a single frame.
  • Loading branch information
BingXuanBaka committed Oct 10, 2023
1 parent 4c762f9 commit cccae2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flame_lottie/lib/src/lottie_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LottieRenderer {
..enableMergePaths = enableMergePaths ?? false,
_controller = controller ??
EffectController(
duration: duration ?? composition.duration.inSeconds.toDouble(),
duration: duration ?? composition.duration.inMilliseconds / 1000,
infinite: repeating ?? false,
) {
size.addListener(() {
Expand Down

0 comments on commit cccae2e

Please sign in to comment.