项目作者: Frgallah

项目描述 :
Interactive Core Image transition for view controller, just for fun not for real Apps
高级语言: Swift
项目地址: git://github.com/Frgallah/Fun.git
创建时间: 2017-04-26T22:09:44Z
项目社区:https://github.com/Frgallah/Fun

开源协议:MIT License

下载


Fun

CI Status
Platform
Language
Xcode
Version
License

Introduction

Fun is an Interactive Core Image transition for view controller, just for fun not for real Apps. By using a few lines of code you can get an elegant transition..

Requirements

  • iOS 10.0+
  • Xcode 8.2+
  • Swift 3

Installation

CocoaPods.

To install it, simply add the following lines to your Podfile:

  1. use_frameworks!
  2. pod "Fun"

Manually

Copy Sources folder to your Xcode project.

Usage

How to use Fun to create a custom transition:

Navigation and TabBar Controller

Code

In the root view controller or the first view controller:

  1. Get a reference to your Navigation or TabBar Controller
  2. Create a Navigation or TabBar Controller delegate using Navigation or TabBar Controller, transition type and is Interactive as parameters.
  3. Optional: in your delegate object
  • set the transition duration
  • set the gesture direction
  1. Your Done!

Navigation Controller

  1. // In the root view controller
  2. override func viewDidLoad() {
  3. super.viewDidLoad()
  4. // 1- Get a reference to your Navigation Controller
  5. guard let navigationController = self.navigationController else {
  6. return
  7. }
  8. // 2- Create a Navigation Controller delegate with :
  9. let navigationControllerDelegate = FunNavigationControllerDelegate.init(navigationController: navigationController, transitionType: .ZoomBlur, isInteractive: true)
  10. // 3- Optional: in your delegate object
  11. // - set the transition duration
  12. // - set the gesture direction
  13. navigationControllerDelegate.duration = 1.4
  14. navigationControllerDelegate.gesturePopDirection = .LeftToRight
  15. }

TabBar Controller

  1. // In the first view controller
  2. override func viewDidLoad() {
  3. super.viewDidLoad()
  4. // 1- Get a reference to your TabBar Controller
  5. guard let tabBarController = self.tabBarController else {
  6. return
  7. }
  8. // 2- Create a tabBar Controller delegate with :
  9. let tabBarControllerDelegate = FunTabBarControllerDelegate.init(tabBarController: tabBarController, transitionType: .ZoomBlur, isInteractive: true)
  10. // 3- Optional: in your delegate object
  11. // - set the transition duration
  12. // - set the gesture direction
  13. tabBarControllerDelegate.duration = 1.4
  14. tabBarControllerDelegate.gestureDirection = .LeftToRight
  15. }

Modal Controller

In code

In the source or presenting view controller:

  1. Create or get a reference to your destination controller
  2. set the modal Presentation Style of your destination controller to full screen
  3. Create a Modal Controller delegate using the destination controller and a transition type as parameters.
  4. Optional:
  • make the transition interactive
  • set the transition duration
  • set the gesture direction
  1. Your Done!
  1. // In the source or presenting view controller:
  2. @IBAction func presentViewControllerModally(_ sender: Any) {
  3. // 1- Create your destination Controller
  4. guard let destinationController = storyboard?.instantiateViewController(withIdentifier: "desVC") as? DestinationViewController else { return }
  5. /*
  6. or get a reference to your destination controller if you are using prepare for segue function
  7. let destinationController = segue.destination
  8. */
  9. // 2- set the modal Presentation Style of your destination controller to full screen
  10. destinationController.modalPresentationStyle = .fullScreen
  11. // 3- Create a Modal Controller delegate using the destination controller and a transition type as parameters.
  12. let controllerDelegate = FunModalControllerDelegate.init(destinationController: destinationController, transitionType: .ZoomBlur)
  13. // 4- Optional:
  14. // - make the transition interactive
  15. // supply a pan gesture if the destination controller view already has a one, if not do not warry about it, the Modal Controller Delegate will create one for you.
  16. controllerDelegate.addInteractiveToDestinationController(panGesture: nil)
  17. // - set the transition duration
  18. controllerDelegate.duration = 2
  19. // - set the gesture direction
  20. controllerDelegate.gestureDismissalDirection = .RightToLeft
  21. // - present the destination controller modally
  22. present(destinationController, animated: true, completion: nil)
  23. }

Example

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

Author

frgallah, frgallah@outlook.com

Transitions

  • GaussianBlur
  • MotionBlur
  • Zoom Blur
  • Bump
  • Circle Splash
  • Droste
  • Glass
  • Light Tunnel
  • Twirl
  • Vortex
  • Circular Screen
  • Dot Screen
  • Line Screen
  • Crystallize
  • Hexagonal Pixellate
  • Pixellate
  • Pointillize
  • SpotLight
  • Kaleidoscope
  • Triangle Kaleidoscope
  • Triangle Tile

1. ZoomBlur




2. Crystallize




3. CircleSplash




4. CircularScreen




5. Kaleidoscope




License

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