All Projects → yannickl → Perspective

yannickl / Perspective

Licence: mit
Powerful scrolling and motion parallax for iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Perspective

Vue Parallax
🌌 Vue.js component for parallax image scroll effects
Stars: ✭ 569 (+118.85%)
Mutual labels:  scrolling, parallax
Phytouch
Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web - 丝般顺滑的触摸运动方案
Stars: ✭ 2,854 (+997.69%)
Mutual labels:  scrolling, motion
Parallaxscrollingview
Parallax scrolling either by offset or automatically.
Stars: ✭ 91 (-65%)
Mutual labels:  scrolling, parallax
Paroller.js
Parallax scrolling jQuery plugin
Stars: ✭ 535 (+105.77%)
Mutual labels:  scrolling, parallax
momentum
Track movement and basic events with CSS custom properties
Stars: ✭ 19 (-92.69%)
Mutual labels:  parallax, scrolling
inview
Detect when element scrolled to view
Stars: ✭ 35 (-86.54%)
Mutual labels:  scrolling
vue3-spring
A spring-physics based animation library, and more
Stars: ✭ 30 (-88.46%)
Mutual labels:  parallax
optimo
Keyframe-based motion editing system using numerical optimization [CHI 2018]
Stars: ✭ 22 (-91.54%)
Mutual labels:  motion
MGT-python
Musical Gestures Toolbox for Python
Stars: ✭ 25 (-90.38%)
Mutual labels:  motion
Vim Asterisk
❄️ *-Improved
Stars: ✭ 255 (-1.92%)
Mutual labels:  motion
englishextra.github.io
English Grammar for Russian-Speakers, a PWA website + SPA
Stars: ✭ 19 (-92.69%)
Mutual labels:  parallax
buildings-wave
🏤 A tutorial on how to create a 3D building wave animation with three.js and TweenMax
Stars: ✭ 66 (-74.62%)
Mutual labels:  motion
scrollxp
Alpine.js-esque library for scrolling animations on websites
Stars: ✭ 50 (-80.77%)
Mutual labels:  parallax
react-native-giphy
Integrate GIPHY into your React Native project (works with react-native-gifted-chat)
Stars: ✭ 25 (-90.38%)
Mutual labels:  scrolling
scrollparent.js
A function to get the scrolling parent of an html element.
Stars: ✭ 51 (-80.38%)
Mutual labels:  scrolling
react-recycled-scrolling
Simulate normal scrolling by using only fixed number of DOM elements for large lists of items with React Hooks
Stars: ✭ 26 (-90%)
Mutual labels:  scrolling
ng-scrollable
Superamazing scrollbars for AngularJS
Stars: ✭ 58 (-77.69%)
Mutual labels:  scrolling
motion-transitioning-objc
Light-weight API for building UIViewController transitions.
Stars: ✭ 24 (-90.77%)
Mutual labels:  motion
react-overflow-indicator
Detect overflow and render shadows, fades, arrows, etc.
Stars: ✭ 66 (-74.62%)
Mutual labels:  scrolling
preact-custom-scrollbars
⇅ Preact scrollbars component
Stars: ✭ 20 (-92.31%)
Mutual labels:  scrolling

Perspective

Supported Platforms Version Carthage compatible Build status

Perspective is a powerful and lightweight library to create scrolling and motion parallax.

Scrolling and motion parallax

(Credits: the assets used in the example project come from Free Game Assets)

RequirementsUsageInstallationContributionContactLicense

Requirements

  • iOS 11.0+
  • Xcode 10.0+
  • Swift 5+

Usage

Basics

Create a PerspectiveView:

import Perspective

let perspectiveView = PerspectiveView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))

view.addSubview(perspectiveView)

Configure its contentSize:

perspectiveView.contentSize = CGSize(width: 1599, height: 900)

Add the images as arranged subviews:

for i in stride(from: 7, to: 0, by: -1) {
  let imgView = UIImageView(image: UIImage(named: "castle-layer0\(i)"))
  imgView.frame.size = CGSize(width: 1599, height: 900)

  perspectiveView.addArrangedSubview(imgView)
}

Behaviours

A behaviour is an object that allows you to interact with the perspective view. If you want to let your users to scroll the persective you can add a PerspectiveScrollBehaviour, and if you want to use the accelerometer just add a PerspectiveMotionBehaviour. To add a new behaviour to your perspective view you must call the addBehaviour method.

Scroll

perspectiveView.addBehaviour(PerspectiveScrollBehaviour())

Motion

perspectiveView.addBehaviour(PerspectiveMotionBehaviour())

How it works

Layers

  1. the PerspectiveView's frame rectangle: describes the view’s location and size in its superview’s coordinate system like any another UIView.
  2. the PerspectiveView's contentSize: defines the extent of the content (usually UIImageView).
  3. the arrangedSubviews: list the views arranged by the perspective view. The order of the views work like in any UIView. The foreground view is at the end of the array (as opposite to the background which is the first element of the array).

Configuration

If you use the motion behaviour, configure the UIRequiredDeviceCapabilities key of its Info.plist file with the accelerometer and gyroscope values:

Required device capabilities

To go further, take a look at the example project.

Installation

The recommended approach to use Perspective in your project is using the CocoaPods package manager, as it provides flexible dependency management and dead simple installation.

CocoaPods

Install CocoaPods if not already available:

$ [sudo] gem install cocoapods
$ pod setup

Go to the directory of your Xcode project, and Create and Edit your Podfile and add Perspective:

$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

use_frameworks!
pod 'Perspective', '~> 0.9.1'

Install into your project:

$ pod install

Open your project in Xcode from the .xcworkspace file (not the usual project file):

$ open MyProject.xcworkspace

You can now import Perspective framework into your files.

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Perspective into your Xcode project using Carthage, specify it in your Cartfile file:

github "yannickl/Perspective" >= 0.9.1

Manually

Download the project and copy the Perspective folder into your project to use it in.

Contribution

Contributions are welcomed and encouraged .

Contact

Yannick Loriot

License (MIT)

Copyright (c) 2018-present - Yannick Loriot

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].