Cocoa - Core Animation - How to stop proxy animation? -
i have nswindow fade in invisible full opacity, on custom time, using animator proxy:
[nsanimationcontext begingrouping]; [[nsanimationcontext currentcontext] setduration:1.0f]; // custom timing, 1 sec. [[mywindow animator] setalphavalue: 1.0f]; [nsanimationcontext endgrouping];
however, if attempt set window's visibility while animation proceeding, animation not stopped. in following example, window briefly appear @ 0.5 visibility, continue animate.
e.g.
[mywindow setalphavalue: 0.5f]; // animation continues after calling this.
q. how can stop animation?
thanks.
i've got application pretty (the menu bar covering window in shroud) , answering question found bug in it—although animations 0.1s never triggered in practice. thanks. :-)
animation durations of 0s special-cased behave setting alpha value directly, can't use them, can use small duration, this, create new animation supersedes in-progress one:
[nsanimationcontext begingrouping]; [[nsanimationcontext currentcontext] setduration:0.01]; [[mywindow animator] setalphavalue:0.5]; [nsanimationcontext endgrouping];
Comments
Post a Comment