7
我有一個NSWindow這是我從無形淡入到完全不透明,在自定義時間,使用動畫代理:可可 - 核心動畫 - 如何停止代理動畫?
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:1.0f]; // Custom timing, 1 sec.
[[myWindow animator] setAlphaValue: 1.0f];
[NSAnimationContext endGrouping];
但是,如果我嘗試設置窗口的可見性而動畫正在進行,動畫不停止。在以下示例中,該窗口將短暫顯示爲0.5可見性,但會繼續生成動畫。
例如
[myWindow setAlphaValue: 0.5f]; // Animation continues after calling this.
問:如何停止動畫?
謝謝。
謝謝尼古拉斯。是的,在發現0.0f不起作用之後,我剛剛得出了關於設置一個很短的持續時間的相同結論。乾杯。 – SirRatty 2011-02-19 03:48:34