CosmicMind / Motion

A library used to create beautiful animations and transitions for iOS.

Home Page:http://cosmicmind.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

control interactive transition

pockerhead opened this issue · comments

Hello! How can I control an interactive transition? In Hero we can do this like:

`

@objc func pan(gr: UIPanGestureRecognizer) {

    let translation = gr.translation(in: self)

    switch gr.state {
    case .began:
        parentViewController?.dismiss(animated: true, completion: nil)
    case .changed:
        Hero.shared.update(translation.y / bounds.height)
    default:
        let velocity = gr.velocity(in: self)
        if ((translation.y + velocity.y) / bounds.height) > 0.5 {
            Hero.shared.finish()
        } else {
            Hero.shared.cancel()
        }
    }
}

`

But in Motion we have the following lines, that commented:
`
/**

The singleton class/object for controlling interactive transitions.

Motion.shared

Use the following methods for controlling the interactive transition:

func update(progress: Double)
func end()
func cancel()
func apply(transitions: [MotionTargetState], to view: UIView)

*/
`

May be there is another way to do this?

They are not commented out, it's just an informational comment. Actual code is in MotionTransition+Interactive.swift file. But they are not marked as public. There are some bugs for interactive transition stuff right now. We are working on it and for next release it will be available.

We will leave this open until the feature has been completed.

development branch now contains all the necessary code for interactive transitions.

@OrkhanAlikhanov thank you, and @pockerhead if you would like to join our Slack channel to give feedback and learn about how to use it best, send your email to support@cosmicmind.com.

Just wondering if there's documentation on how to perform interactive transition on a UINavigationController using Motion?