Beautiful & simple parallax effects for your UI. π Perfect for Onboarding & Login/Signup screens - Recreate the well-known iOS wallpaper animation by dividing your ViewController in background, middleground and foreground elements which each receive different motionEffects.
SimpleParallax works by extending UIView. In order to apply a Parallax-MotionEffect to one of your UIView-objects, simply call one of the following methods:
- addBackgroundPxEffect()
- addMiddlegroundPxEffect()
- addForegroundPxEffect()
Furthermore, you can specify the strength of the Parallax-effect:
If you don't pass the strength as an argument, .Mid is used by default.
enum ParallaxStrength {
case Low
case Mid
case High
}
override func viewDidLoad() {
super.viewDidLoad()
//Lets assign our Backgrounds:
background2.addBackgroundPxEffect(strength: .Low)
background1.addBackgroundPxEffect(strength: .Mid)
//Lets assign our Middleground:
titleLabel.addMiddlegroundPxEffect()
//Lets assign our Foreground:
startButton.addForegroundPxEffect(strength: .High)
}
Import/copy π SimpleParallax.swift into the directory of your project - Done!