Ky -
Ky -

Reputation: 32143

Is it possible to control the duration and timing function of a NSViewController transition?

I'm using NSViewController's transition(from:to:options:completionHandler:). It is working beautifully, but now I am wanting more control (like a custom timing function).

Is this possible? Or would it require another approach to transitioning between view controllers?

Upvotes: 1

Views: 238

Answers (1)

Ky -
Ky -

Reputation: 32143

Yes, you can modify the animation context if you capture it in an animation group:

NSAnimationContext.runAnimationGroup({ context in
    context.duration = 3

    parentController.transition(from: childA, to: childB: options: yourOptions, completionHandler: yourCompletionHandler)
})

Unfortunately, it seems, modifying the context's timingFunction property doesn't do anything.


For OS X 10.11 and older, you may use this shim: https://gist.github.com/BenLeggiero/63f84d5f7fd8c9b3c9501d1b68110983

Upvotes: 2

Related Questions