lottie-ios
lottie-ios copied to clipboard
[Feature Request] Disable animations globally
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 how do you disable the animations while you take the snapshots?
Just set UIView.setAnimationsEnabled(false)
@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 ?
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.