• Stars
    star
    117
  • Rank 300,893 (Top 6 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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 Logo


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 Animation GIF

Usage

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
}  

Example implementation in viewDidLoad():

  
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)
    }

Installation

Import/copy πŸ“„ SimpleParallax.swift into the directory of your project - Done!