Lagging with new dotLottie package

Since updating to the new lottiefiles/dotLottie-ios package, I have several issues with my app.

  1. Energy impact is very high when running on a device.
  2. Transitions are noticeably slower.
  3. Some animations cause the renderer to crash

I am calling animations from within a View:

DotLottieAnimation(fileName: name, config: AnimationConfig(autoplay: true, loop: true, mode: mode, speed: Float(speedSetting), useFrameInterpolation: true)).view()

I have tried also calling animations from within a UIViewRepresentable:

func makeUIView(context: Context) -> some DotLottieAnimationView {
        let view: UIView = UIView(frame: .zero)
        
        let simpleVM = DotLottieAnimation(fileName: animationFileName, config: AnimationConfig(autoplay: true, loop: true))
        let loaderView: DotLottieAnimationView = simpleVM.view()
        loaderView.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(loaderView)
        loaderView.frame = view.bounds
        
        return loaderView
    }

While I am able to isolate and avoid certain animations, I haven’t been able to resolve the lagging and high energy impact. I am unable to make updates to my app using this new package until I can resolve these issues. I appreciate any feedback.

hi @Sack_of_Songs Theres a few things I can propose to help with these issues:

  • Disabling frame interpolation will help with increasing performance and might not cause a noticeable difference in your case

  • Try changing the width and height. This can cause a resolution drop if you decrease it too much, but in my experience you can lower these values and increase performance without a noticeable difference

  • More advanced performance improvement would be to pause playback if the animation isn’t visible on screen

1 Like

Thank you so much for your reply!

I was able to mostly resolve the issues yesterday by switching to the new Lottie crafted for SwiftUI. However, there is a noticeable second or two delay compared to using the deprecated DotLottie.

1 Like