lottie-ios icon indicating copy to clipboard operation
lottie-ios copied to clipboard

[Feature Request] Disable animations globally

Open xavierLowmiller opened this issue 5 years ago • 4 comments

Description

In our app, we do a lot of snapshot testing. To keep these deterministic, we disable the Lottie animations by hand, which works :+1:.

It would be much easier, though, if Lottie looked at UIView.areAnimationsEnabled so that animations could be enabled or disabled globally.

If you're interested, I can try and submit a pull request.

Check these before submitting:

  • [x] The issue doesn't involve an Unsupported Feature
  • [x] This issue isn't related to another open issue

This issue is a:

  • [ ] Non-Crashing Bug (Visual or otherwise)
  • [ ] Crashing Bug
  • [x] Feature Request
  • [ ] Regression (Something that once worked, but doesn't work anymore)

Which Version of Lottie are you using?

Lottie 3.0

What Platform are you on?

  • [ ] MacOS
  • [x] iOS

What Language are you in?

  • [x] Swift
  • [ ] Objective-C

xavierLowmiller avatar Apr 09 '19 13:04 xavierLowmiller

@xavierLowmiller how do you disable the animations while you take the snapshots?

kwstasna avatar Sep 18 '20 13:09 kwstasna

Just set UIView.setAnimationsEnabled(false)

xavierLowmiller avatar Sep 18 '20 13:09 xavierLowmiller

@xavierLowmiller ah ok! Do you know how to display only the final frame so that the test don’t have to wait for the animation to finish ?

kwstasna avatar Sep 18 '20 13:09 kwstasna

Oh sorry, you mean how we disable the Lottie animations?

I can't take a look how we exactly did it because I've switched jobs and don't have access to the code base.

As far as I remember, we just called stop() on the view, and maybe set the animationProgress to some deterministic value.

xavierLowmiller avatar Sep 18 '20 14:09 xavierLowmiller