Questions tagged [nsanimationcontext]

28 questions
17
votes
4 answers

NSLayoutConstraint.constant ignoring animation

I'm creating an autolayout-friendly split view class for one of my applications. Among its various features is that it can collapse panes, and can animate their collapse, much as you might have seen NSSplitView do. Since I'm using constraints, I'm…
Brent Royal-Gordon
  • 16,531
  • 6
  • 53
  • 86
12
votes
0 answers

What's the best approach to animate frame changes on NSView?

Ideally I'd need something like UIView.animateWithDuration, however I know that this is not an API that's available on macOS. What's the best way to manipulate the actual frame of an NSView and animate the changes? I tried going for…
Martin Velchevski
  • 834
  • 10
  • 30
8
votes
1 answer

Animating Auto Layout constraints with NSView.layoutSubtreeIfNeeded() not working on macOS High Sierra

I have a basic Mac app with a view animation done through Auto Layout: I add a new view to the right of the current view I update the constraints so that the new view ends up filling the window → The animation will make it appear as if the view…
Mark
  • 5,965
  • 1
  • 37
  • 77
8
votes
1 answer

Check if NSAnimationContext runAnimationGroup cancelled or succeeded

I'm animating a view (by revealing it) after which I need to post a notification (once the animation completes). However the way the app's designed, there's another notification sent out when the view is hidden (via animation). So essentially I have…
strange
  • 9,434
  • 6
  • 31
  • 44
6
votes
1 answer

Fade out NSButton using NSAnimationContext

I have a simple Swift macOS app (using Xcode 8.2.1) that contains a single NSButton. When I click the button I would like it to fade out over a specified period. I thought I could use NSAnimationContext but no matter what value I set the context…
RobertJoseph
  • 7,336
  • 9
  • 58
  • 100
5
votes
1 answer

NSAnimationContext does not animate frame size for NSButton

Using NSAnimationContext.runAnimationGroup(_:_:) as demonstrated in the NSAnimationContext documentation to animate both the frame origin and size works as expected for some view types (including NSImageView). However, it does not work as expected…
drootang
  • 1,810
  • 1
  • 15
  • 23
4
votes
1 answer

El Capitan broke my NSView animations

I have a Mac app that uses a NSAnimationContext animation grouping to animate one NSView offscreen and another NSView onscreen. Prior to beginning the animation grouping I position the offscreen NSView in the position that I want it to originate…
Carter
  • 4,642
  • 2
  • 19
  • 24
4
votes
1 answer

Slow down or pause NSAnimationContext

I have an NSAnimationContext (just a scrolling view) that I would like to slow down and/or pause whenever the cursor enters the view. I have already implemented the detection for when this happens - now I just need to figure out how to slow down the…
xizor
  • 1,486
  • 2
  • 16
  • 34
3
votes
3 answers

Why NSAnimationContext completionHandler does not work (sometimes)?

// wc here is an NSWindowController [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setDuration:0.5f]; if (duplication) { NSPoint origin = initialSize.origin; origin.y +=…
Hofi
  • 883
  • 1
  • 6
  • 17
3
votes
2 answers

Rotating NSView around center

I'm trying to animate the rotation of an NSView around its center, but it keeps shifting side to side during rotation. What is causing this? -(void)startRefreshAnimation { [NSAnimationContext beginGrouping]; [[NSAnimationContext…
Jack Humphries
  • 12,423
  • 14
  • 77
  • 119
2
votes
0 answers

Animated resizing of a NSView does not effect layer. Bug or totally correct?

I have two NSView subclasses: DrawRectView just draws a background color using the drawRect method LayerBackedView also draws a background color using layer backing The following code snippet a resizing animation via click actions on the…
Marc
  • 2,072
  • 2
  • 23
  • 36
2
votes
1 answer

NSAnimation removes button background colour

I am working on a Mac app. I am trying to do a simple animation which makes an NSButton move down. The animation works really nicely, but when i do it, the background colour of my NSButton disappears for some reason. Here is my code: // Tell the…
Supertecnoboff
  • 5,886
  • 9
  • 50
  • 94
1
vote
1 answer

NSAnimationContext crashing when called by an Observer

I have two WebViews: webView and customizerWebView. Both of these WKWebViews are attached by a trailing constraint. Essentially, when I go to the menu and click "Show Customizer" showCustomizer() or "Hide Customizer" hideCustomizer(), it calls the…
Justin Bush
  • 3,998
  • 5
  • 30
  • 54
1
vote
0 answers

NSView fade animation doesn't work

I have created a new project with one button and one hidden NSView (I called this annimationView). The idea is when user pressed the button than the hidden view should fade in and out. But nothing happens on the first time. If I press the button…
alex.b
  • 184
  • 1
  • 2
  • 14
1
vote
1 answer

Shake animation for NSTextField

Based similar questions asked about UIView and UITextField shake animations, Ive implemented this code which should apply to NSTextFields. However the animation never runs. What is the problem here? NSRect textFieldFrame = [textfield…
1
2