/CALayerSpeedDemo

A simple iOS app demoing the effect of adjusting the speed property on a CALayer object, in particularly the CALayer object of a UIWindow. Watch as the app speeds up and slows down! 👀

Primary LanguageSwift

CALayer Speed Demo

This is a simple iOS app that demos the effect of adjusting the speed property on a CALayer object, in particularly the CALayer object of a UIWindow. Watch as the app speeds up and slows down! 👀

You can read the full blog post on this topic here.

Usage

For double-speed animations:

window.layer.speed = 2.0 // Super fast 🏎💨 

For half-speed animations:

window.layer.speed = 0.5 // Super slow 🐢

For a subtle speed boost:

window.layer.speed = 1.2 // Subtle boost 👌

To set back to the default:

window.layer.speed = 1.0 // default

To set this up in your own app AppDelegate:

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
	var window: UIWindow?

	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
		
		window = UIWindow(frame: UIScreen.main.bounds)
		window?.layer.speed = 1.2 // Subtle boost
		
		return true
	}	
}