{"id":14961293,"url":"https://github.com/yannickl/perspective","last_synced_at":"2025-05-08T20:56:06.264Z","repository":{"id":56921399,"uuid":"166830613","full_name":"yannickl/Perspective","owner":"yannickl","description":"Powerful scrolling and motion parallax for iOS","archived":false,"fork":false,"pushed_at":"2020-01-08T14:14:50.000Z","size":2199,"stargazers_count":268,"open_issues_count":1,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T18:11:15.305Z","etag":null,"topics":["ios","motion","parallax","parallax-scrolling","scrolling"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yannickl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-21T14:48:46.000Z","updated_at":"2024-08-10T09:24:59.000Z","dependencies_parsed_at":"2022-08-21T04:50:43.979Z","dependency_job_id":null,"html_url":"https://github.com/yannickl/Perspective","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FPerspective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FPerspective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FPerspective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FPerspective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yannickl","download_url":"https://codeload.github.com/yannickl/Perspective/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149404,"owners_count":21861718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","motion","parallax","parallax-scrolling","scrolling"],"created_at":"2024-09-24T13:24:29.603Z","updated_at":"2025-05-08T20:56:06.237Z","avatar_url":"https://github.com/yannickl.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/798235/51530434-36096580-1e3b-11e9-935e-8d5114c344ed.png\" alt=\"Perspective\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://cocoadocs.org/docsets/Perspective/\"\u003e\u003cimg alt=\"Supported Platforms\" src=\"https://cocoapod-badges.herokuapp.com/p/Perspective/badge.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"http://cocoadocs.org/docsets/Perspective/\"\u003e\u003cimg alt=\"Version\" src=\"https://cocoapod-badges.herokuapp.com/v/Perspective/badge.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg alt=\"Carthage compatible\" src=\"https://img.shields.io/badge/Carthage-%E2%9C%93-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/yannickl/Perspective\"\u003e\u003cimg alt=\"Build status\" src=\"https://travis-ci.org/yannickl/Perspective.svg?branch=master\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n***Perspective*** is a powerful and lightweight library to create scrolling and motion parallax.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/798235/51496460-24cf4300-1dc0-11e9-9d6c-97d753498f5b.gif\" alt=\"Scrolling and motion parallax\" /\u003e\n\u003c/p\u003e\n\n*(Credits: the assets used in the example project come from [Free Game Assets](https://free-game-assets.itch.io/free-parallax-2d-backgrounds))*\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#requirements\"\u003eRequirements\u003c/a\u003e • \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e • \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e • \u003ca href=\"#contribution\"\u003eContribution\u003c/a\u003e • \u003ca href=\"#contact\"\u003eContact\u003c/a\u003e • \u003ca href=\"#license-mit\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n## Requirements\n\n- iOS 11.0+\n- Xcode 10.0+\n- Swift 5+\n\n## Usage\n\n### Basics\n\nCreate a `PerspectiveView`:\n\n```swift\nimport Perspective\n\nlet perspectiveView = PerspectiveView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))\n\nview.addSubview(perspectiveView)\n```\n\nConfigure its `contentSize`:\n\n```swift\nperspectiveView.contentSize = CGSize(width: 1599, height: 900)\n```\n\nAdd the images as arranged subviews:\n\n```swift\nfor i in stride(from: 7, to: 0, by: -1) {\n  let imgView = UIImageView(image: UIImage(named: \"castle-layer0\\(i)\"))\n  imgView.frame.size = CGSize(width: 1599, height: 900)\n\n  perspectiveView.addArrangedSubview(imgView)\n}\n```\n\n### Behaviours\n\nA 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.\n\n#### Scroll\n\n```swift\nperspectiveView.addBehaviour(PerspectiveScrollBehaviour())\n```\n\n#### Motion\n\n```swift\nperspectiveView.addBehaviour(PerspectiveMotionBehaviour())\n```\n\n### How it works\n\n![Layers](https://user-images.githubusercontent.com/798235/51544126-7a0e6180-1e5f-11e9-8071-a53271c99431.png)\n\n1. the `PerspectiveView`'s `frame` rectangle: describes the view’s location and size in its superview’s coordinate system like any another `UIView`.\n2. the `PerspectiveView`'s `contentSize`: defines the extent of the content (usually `UIImageView`).\n3. 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).\n\n### Configuration\n\nIf you use the motion behaviour, configure the `UIRequiredDeviceCapabilities` key of its *Info.plist* file with the `accelerometer` and `gyroscope` values:\n\n![Required device capabilities](https://user-images.githubusercontent.com/798235/51685656-0ef39500-1fef-11e9-85e6-3354a786feec.png)\n\nTo go further, take a look at the example project.\n\n## Installation\n\nThe recommended approach to use *Perspective* in your project is using the [CocoaPods](http://cocoapods.org/) package manager, as it provides flexible dependency management and dead simple installation.\n\n#### CocoaPods\n\nInstall CocoaPods if not already available:\n\n``` bash\n$ [sudo] gem install cocoapods\n$ pod setup\n```\nGo to the directory of your Xcode project, and Create and Edit your *Podfile* and add _Perspective_:\n\n``` bash\n$ cd /path/to/MyProject\n$ touch Podfile\n$ edit Podfile\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '11.0'\n\nuse_frameworks!\npod 'Perspective', '~\u003e 0.9.1'\n```\n\nInstall into your project:\n\n``` bash\n$ pod install\n```\n\nOpen your project in Xcode from the .xcworkspace file (not the usual project file):\n\n``` bash\n$ open MyProject.xcworkspace\n```\n\nYou can now `import Perspective` framework into your files.\n\n#### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate `Perspective` into your Xcode project using Carthage, specify it in your `Cartfile` file:\n\n```ogdl\ngithub \"yannickl/Perspective\" \u003e= 0.9.1\n```\n\n#### Manually\n\n[Download](https://github.com/yannickl/Perspective/archive/master.zip) the project and copy the `Perspective` folder into your project to use it in.\n\n## Contribution\n\nContributions are welcomed and encouraged *♡*.\n\n## Contact\n\nYannick Loriot\n - [https://21.co/yannickl/](https://21.co/yannickl/)\n - [https://twitter.com/yannickloriot](https://twitter.com/yannickloriot)\n\n## License (MIT)\n\nCopyright (c) 2018-present - Yannick Loriot\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannickl%2Fperspective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyannickl%2Fperspective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannickl%2Fperspective/lists"}