CosmicMind / Motion

A library used to create beautiful animations and transitions for iOS.
http://cosmicmind.com
MIT License
1.77k stars 119 forks source link

control interactive transition #52

Closed pockerhead closed 6 years ago

pockerhead commented 6 years ago

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?

OrkhanAlikhanov commented 6 years ago

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.

daniel-jonathan commented 6 years ago

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

OrkhanAlikhanov commented 6 years ago

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

daniel-jonathan commented 6 years ago

@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.

guidedways commented 4 years ago

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