Coder Social home page Coder Social logo

pathdynamicmodal's Introduction

PathDynamicModal

A modal view using UIDynamicAnimator, like the Path for iOS.

Screen shots

screen shot1 screen shot2

Animation

animated gif

Explanation

This is the library that present modal with dynamic animation.
Slant of dismiss modal by tap background is depend on tap horizontal position.
Also, slant of swiping modal is depend on touch horizontal position and amount of swipe down.
If you want to change the modal dropping speed, please set the property showMagnitude or closeMagnitude.
By all means, use the Demo-project.

Installation

Simply copy & paste PathDynamicModal.swift into your project.
Or, use the git-submodule, please.
git submodule add https://github.com/ra1028/PathDynamicModal PathDynamicModal
Cocoapods has not yet supported.

Usage

  1. Create a instance of any UIView subclass.
  2. Call the show(modalView: , inView: ) of PathDynamicModal class-function or instance-function.
  3. For detail, please refer to Demo-project.

Functions

class func show(modalView view: UIView, inView: UIView) -> PathDynamicModal // Show modal with settings default all.
func show(modalView view: UIView, inView: UIView) // Show modal with custom settings.
func closeWithLeansRandom() // Close modal with random slant.
func closeWithStraight() // Close modal with non slant.
func closeWithLeansRight() // Close modal with right slant.
func closeWithLeansLeft() Close modal with left slant.

Property

var backgroundColor: UIColor // Default is UIColor.blackColor()
var backgroundAlpha: CGFloat // Default is 0.7 
var showMagnitude: CGFloat // Default is 250.0. This affects the speed of modal dropping to show.
var closeMagnitude: CGFloat // Default is 170.0. This affects the speed of modal dropping to close.
var closeByTapBackground: Bool // Default is true
var closeBySwipeBackground: Bool // Default is true
var showedHandler: (() -> Void)?
var closedHandler: (() -> Void)?

License

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

pathdynamicmodal's People

Contributors

akring avatar ra1028 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.