title: Cocoa - Core Animation - How to stop proxy animation?
body: <p>I have an NSWindow which I fade in from invisible to full opacity, over a custom time, using the <strong>animator</strong> proxy:</p>
  
  <pre><code>[NSAnimationContext beginGrouping];
  [[NSAnimationContext currentContext] setDuration:1.0f]; // Custom timing, 1 sec.
  [[myWindow animator] setAlphaValue: 1.0f];
  [NSAnimationContext endGrouping];
  </code></pre>
  
  <p>However, if I attempt to set the window's visibility <strong>while</strong> the animation is proceeding, the animation is not stopped. In the following example, the window will briefly appear at 0.5 visibility, but will then continue to animate.</p>
  
  <p>e.g.</p>
  
  <pre><code>[myWindow setAlphaValue: 0.5f];  // Animation continues after calling this.
  </code></pre>
  
  <p><strong>Q. How can I stop the animation?</strong></p>
  
  <p>Thanks.</p>