Latest 0.2.3
Homepage https://github.com/syjdev/HorizontalParallaxScrollView
License MIT
Platforms ios 8.0
Authors

Version
License
Platform

Demo Animation

You can see above demo project code.
demo project code

Usage

  • First, You have to define HorizontalParallaxScrollView object.
let view = UIView(frame: CGRect(x: ?, y: ?, width: ?, height: ?))
let item = HorizontalParallaxScrollViewItem(view: view,
                                            originOffset: CGPoint(x: 150, y: 80),
                                            acceleration: ParallaxAcceleration.invariable(CGPoint(x: 1, y: 1)),
                                            progress: { (parallaxView, view) in
                                                //...
                                            })

If you want, You can define a dynamic acceleration.

let dynamicAcceleration = ParallaxAcceleration.variable { (parallaxView, view) -> CGPoint in
                            let progressRatio = (parallaxView.contentSize.width - 3 * parallaxView.contentOffset.x) / parallaxView.contentSize.width
                            return CGPoint(x: 0.65 * progressRatio, y: 0.65 * (1 - progressRatio))
                          }

let view = UIView(frame: CGRect(x: ?, y: ?, width: ?, height: ?))
let item = HorizontalParallaxScrollViewItem(view: view,
                                            originOffset: CGPoint(x: 150, y: 80),
                                            acceleration: dynamicAcceleration,
                                            progress: { (parallaxView, view) in
                                                //...
                                            })
  • Second, Build a parallaxView.
let parallaxView = HorizontalParallaxScrollViewBuilder.setOption { (option) in
                        option.frame = CGRect(x: 0, y: 100, width: view.frame.size.width, height: view.frame.size.height - 100)
                        option.parallaxViewItems = [item] // You can add more items.
                        option.isPagingEnabled = false
                   }.build()
parallaxView.delegate = self //Optional

Requirements

Minimum iOS Target : iOS 8.0

Installation

HorizontalParallaxScrollView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'HorizontalParallaxScrollView'

Author

[email protected]

License

HorizontalParallaxScrollView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "HorizontalParallaxScrollView",
    "version": "0.2.3",
    "summary": "Helpful UI Component for configure Horizontal Parallax Effect.",
    "description": "Using HorizontalParallaxScrollView is an one of wonderful way that configure Horizontal Parallax UI. I will welcome your feedback.",
    "homepage": "https://github.com/syjdev/HorizontalParallaxScrollView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "syjdev": "[email protected]"
    },
    "source": {
        "git": "https://github.com/syjdev/HorizontalParallaxScrollView.git",
        "tag": "0.2.3"
    },
    "source_files": "HorizontalParallaxScrollView/Classes/*",
    "platforms": {
        "ios": "8.0"
    }
}

Pin It on Pinterest

Share This