Apple TV Parallax effect in Swift.

Related tags

UI swift ios parallax
Overview

MPParallaxView

Apple TV Parallax effect in Swift. Rotate view using touch or accelerometer.

Preview

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Want to quickly look at demo? Type pod try MPParallaxView!

Parallax effect

You can easily customize Parallax View in Storyboard! Jump into Example project to look at properties.

How about accelerometer parallax instead of touch? Set Accelerometer Enabled to On in Storyboard.

There are 3 different ways to set up parallax:

  • .basedOnHierarchyInParallaxView - views in background moves less than views in foreground. You can increase the movement by changing multiplerOfIndexInHierarchyToParallaxOffset - this value will be multiplied by index of view in hierarchy. Default.
  • .basedOnTag - set a tag for a view. For instance, snowflakes image view has 13 tag which means noticeable movement. On the other hand, top view with cast members has 1 tag - almost no movement.
  • .custom(Int) - provide your custom value.

Requirements

Xcode 8, iOS 9

Installation

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

pod "MPParallaxView"

Author

Michal Pyrka
Twitter: mikep_3

Other

Check out the article about this repo: Apple TV Parallax Effect in Swift

Inspired by Designmodo
Thanks Konstantine Trundayev for Interstellar assets!

License

The MIT License (MIT) Copyright (c) 2015 - 2017 Droids On Roids LLC

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.

Comments
  • Memory Leak

    Memory Leak

    Retain Cycle here:

    self -> motionManager -> self

    https://github.com/DroidsOnRoids/MPParallaxView/blob/master/MPParallaxView.swift#L104-L110

    motionManager.startAccelerometerUpdates(to: currentQueue) {data, error in
                    self.accelerometerMovement = AccelerometerMovement(x: data?.acceleration.x ?? 0.0, y: data?.acceleration.y ?? 0.0)
                    UIView.animate(withDuration: 0.1, animations: {
                        self.applyParallaxEffectOnView(basedOnTouch: nil)
                        self.applyGlowEffectOnView(basedOnAccelerometerMovement: self.accelerometerMovement)
                    }) 
                }
    
    opened by CodeEagle 2
  • Memory leaking from shadow animation

    Memory leaking from shadow animation

    screen shot 2015-11-12 at 10 14 43

    The current CAAnimationGroup approach is using kCAFillModeForwards alongside removedOnCompletion = NO. The result is that animations are repeatedly added to the layer without deallocating on completion. A fix would be to update the model layer's shadow properties alongside an animation that removes on completion.

    opened by klop 1
  • Add inspectables and improve access control

    Add inspectables and improve access control

    I think the names for the inspectable properties are too long for interface builder. But having a easy way to mess with the properties directly in interface builder is a huge win. It’s a shame that enums can’t be inspectable. This would make our life so much easier.

    opened by paulofaria 1
  • Fixes #2 - Shadow animation memory leak.

    Fixes #2 - Shadow animation memory leak.

    This fixes #2. Model layer is now updated and animations are removed on completion, allowing the desired effect to persist. A new public var finalShadowRadius was added in the process.

    opened by klop 0
  • Issue with some calculation

    Issue with some calculation

    I haven't looked closer to the code (currently no time for that), but I found an issue caused by the release animation. It's better visible with the the Interstellar view. Keep swiping up the view and releasing it for about 15-30 times. After that the images inside the parallax view will have a smaller width and height than its super view and reveal white edges.

    bug 
    opened by DevAndArtist 2
Releases(0.3.0)
Owner
Droids On Roids
Mobile & Web App Development Company
Droids On Roids
Simple parallax header for UIScrollView

MXParallaxHeader ⚠️ This project is no longer maintained, see #124 ⚠️ MXParallaxHeader is a simple header class for UIScrollView. In addition, MXScrol

Maxime Epain 1.7k Dec 9, 2022
ScrollView that supports a parallax header image and static overlay.

ScrollViewReactiveHeader A replacement ScrollView that provides a header with subtle scroll animations. example-video.mov Using ScrollViewReactiveHead

null 49 Dec 29, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 4, 2023
Page view controller with bounce effect

BouncyPageViewController Page view controller with bounce effect inspired by motion design by Stan Yakushevish. Quickstart Create a queue of UIViewCon

Bohdan Orlov 843 Oct 17, 2022
A modern HUD inspired by Apple Music and Apple Podcasts

HUD A modern HUD inspired by Apple Music and Apple Podcasts. Appearance Light Dark HUD Activity Indicator HUD Requirements iOS 13+ Installation You ca

Bei Li 30 Nov 18, 2022
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version

ContainerController UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/ Preview Requirements Installation CocoaPods Swi

Rustam 419 Dec 12, 2022
A library to recreate the iOS Apple Music now playing transition

DeckTransition DeckTransition is an attempt to recreate the card-like transition found in the iOS 10 Apple Music and iMessage apps. Hereʼs a GIF showi

Harshil Shah 2.2k Dec 15, 2022
Kit for building custom gauges + easy reproducible Apple's style ring gauges.

GaugeKit ##Kit for building custom gauges + easy reproducible Apple's style ring gauges. -> Example Usage Open GaugeKit.xcworkspace and change the sch

Petr Korolev 1k Dec 23, 2022
A fancy hexagonal layout for displaying data like your Apple Watch

Hexacon is a new way to display content in your app like the Apple Watch SpringBoard Highly inspired by the work of lmmenge. Special thanks to zenly f

Gautier Gédoux 340 Dec 4, 2022
SpriteKit Floating Bubble Picker (inspired by Apple Music) 🧲

Magnetic Magnetic is a customizable bubble picker like the Apple Music genre selection. Demo Video $ pod try Magnetic Features Adding/Removing Nodes

Lasha Efremidze 1.4k Jan 6, 2023
Flutter Apple Product Store App UI Home Page With Getx

Flutter Apple Product Store App UI Home Page With Getx A new Flutter UI Project on my Youtube Channel . About The Project Create a beautiful Flutter U

Muawia Saeed 11 Dec 23, 2022
Bubble pickers, inspired by Apple

AmazingBubbles Bubble pickers, inspired by Apple Requirements: iOS 9.1+ XCode 8.0+ Swift 3.0 Installation AmazingBubbles Library is available through

Gleb Radchenko 63 Oct 14, 2022
DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.

DrawerKit What is DrawerKit? DrawerKit is a custom view controller presentation mimicking the kind of behaviour in the Apple Maps app. It lets any vie

Babylon Health 773 Dec 27, 2022
Super awesome Swift minion for Core Data (iOS, macOS, tvOS)

⚠️ Since this repository is going to be archived soon, I suggest migrating to NSPersistentContainer instead (available since iOS 10). For other conven

Marko Tadić 306 Sep 23, 2022
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

Evgenii Neumerzhitckii 874 Dec 13, 2022
Protocol oriented, type safe, scalable design system foundation swift framework for iOS.

Doric: Design System Foundation Design System foundation written in Swift. Protocol oriented, type safe, scalable framework for iOS. Features Requirem

Jay 93 Dec 6, 2022
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

Aufree 465 Nov 28, 2022
An easy to use FAQ view for iOS written in Swift

FAQView An easy to use FAQ view for iOS written in Swift. This view is a subclass of UIView. Setup with CocoaPods If you are using CocoaPods add this

Mukesh Thawani 467 Dec 5, 2022