1

I am trying to implement a custom NSView (layer based) with animations in an NSStatusItem's view.

Animating the layer with CABasicAnimation works well with one screen (menu bar), however stops working when I have two screens attached. It then only animates in one menu bar (the active one). If I click on the other one it then becomes active and starts animation. The other one then stops animating.

The release notes from Apple 10.9 release notes say that one needs to "redraw in NSDefaultRunLoopMode" for the clone to redraw.

How do I perform an NSLayer animation in a different run mode to get the animation running on both/multiple manu bars?

Currently my animation looks like this:

CABasicAnimation *an = [CABasicAnimation animationWithKeyPath:@"opacity"];
an.fromValue = @(1.0);
an.toValue = @(0.0);
an.duration = 0.35;
an.repeatCount = 100000;
an.autoreverses = YES;
[self.outerCircle addAnimation:an forKey:@"opacityAnimation"];

What will I need to change in order to get the animation running on the cloned menu bar as well. It has to be possible as the seconds from the clock app are up to date on all menu bars as well.

JNK
  • 1,753
  • 8
  • 25
  • 37
  • Example: Apple changed the animation of Time Machine when doing backups. The icon no longer circles but just indicates that it's doing a backup. This obviously was done because of energy consumption. It might be better for your app to also not have an animation but update the view without animation. See http://arstechnica.com/apple/2013/10/os-x-10-9/23/ and scroll down to Time Machine. – mahal tertin Feb 03 '14 at 11:38
  • I've noticed that. My use case would only animate for a couple of seconds though and I would very much like to keep the animations. – JNK Feb 04 '14 at 10:48

0 Answers0