Skip to content
This repository was archived by the owner on Aug 14, 2022. It is now read-only.

Repository files navigation

HorizontalParallaxScrollView

VersionLicensePlatform

Demo Animation

You can see above demo project code. demo project code

Usage

  • First, You have to define HorizontalParallaxScrollView object.
letview=UIView(frame:CGRect(x:?, y:?, width:?, height:?))letitem=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.

letdynamicAcceleration=ParallaxAcceleration.variable{(parallaxView, view)->CGPointinletprogressRatio=(parallaxView.contentSize.width -3* parallaxView.contentOffset.x)/ parallaxView.contentSize.width
returnCGPoint(x:0.65* progressRatio, y:0.65*(1- progressRatio))}letview=UIView(frame:CGRect(x:?, y:?, width:?, height:?))letitem=HorizontalParallaxScrollViewItem(view: view,
originOffset:CGPoint(x:150, y:80),
acceleration: dynamicAcceleration,
progress:{(parallaxView, view)in
//...
})
  • Second, Build a parallaxView.
letparallaxView=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

MinimumiOSTarget : iOS8.0

Installation

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

pod'HorizontalParallaxScrollView'

History

  • Change Repository & Pod name(SYParallaxScrollView -> HorizontalParallaxScrollView).

Author

syjdev@gmail.com

License

HorizontalParallaxScrollView is available under the MIT license.

About

Useful for Configure Horizontal Parallax Scroll.

Resources

Stars

117 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages