I know how to animate NSView
objects using +[NSAnimationContext runAnimationGroup:completionHandler:]
, but I can't see a way of setting the animation curve on this type of animation. I see that NSAnimation
has an init method which includes a NSAnimationCurve
parameter, but I cannot figure out how to specify what should actually happen during the animation using this method. The documentation for NSAnimation
is really difficult to understand and I can't find any examples. So if somebody could explain how I can either add a curve to NSAnimationContext
animations or specify the animations in a NSAnimation
animation, that would be really helpful. Thanks in advance!
How do I animate NSView with curve
449 Views Asked by mashers At
2
There are 2 best solutions below
0

Swift version of pointium's answer:
NSAnimationContext.current.timingFunction = .init(name: .linear)
What you’re looking for is
timingFunction
.You can set it inside of the
runAnimationGroup
block:and either use predefined functions or create your own with control points.