Toggle Slow Animations
Toggle Slow Animations
iOS Simulator has a feature that slows animations, you can toggle it either by pressing ⌘T or choosing Debug > Toggle Slow Animations in Frontmost App. It’s very useful, but what if we want to do the same on device? It’s easy, fast and simple.
CALayer has a property called speed, which is a time multiplier. This means that if we have an animation with a duration of 1 second, and set the layer’s speed to 2, it’ll take just 0.5 seconds to finish. The best thing about it is that it’s related to the parent layer. So when we change the speed of a particular CALayer, every child layer will be affected. So, if we change UIWindow layer speed, every CALayer in our application will perform animations with that custom speed value. That leaves us with this two extensions:
1
2
3
4
5
6 7 8 9 10 11 12 13 14 15 16 17 18 | |
And you can call it in both ways:
1
2
| |
You can go further and expose this to your testers, through iOS Settings Bundle or a fancy shake gesture. Pretty handy!
转载于:https://www.cnblogs.com/ioriwellings/p/6590229.html
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
