开发者

Core Animation - simulate window closing effect of Windows 7?

开发者 https://www.devze.com 2023-01-05 21:11 出处:网络
I have a basic NSWindow with no decorations (titlebar etc), NSWindow set to not opaque no shadow etc.It sits at the screensaver level (so \"topmost\" window of application)

I have a basic NSWindow with no decorations (titlebar etc), NSWindow set to not opaque no shadow etc. It sits at the screensaver level (so "topmost" window of application)

contentView is set to a subclassed NSView of mine that says "Loading" achieved by drawin开发者_JAVA技巧g a CIImage.

This entire window is centered in the screen. It's opened when a loading event happens elsewhere. When the load is over, I close the window.

Instead of having it instantly appear and instantly disappear, it'd be cool to have it disappear like Windows 7/aero window closing effect, and appear in the same manner.

To clarify: on close the window would grow in size about 20% and fade to translucent. On open the window would appear about 20% larger than it started and fade in to opaque.

How should I do this? One way is that I could make the NSWindow actually be basesize + 20% and maybe use NSAnimation to animate the view. However this doesn't seem to be a direct "good" way. How could I use CA to handle animating this window in the manner I describe? Also open to alternate solutions


You can use NSViewAnimation to fade and resize the window. Contrary to its name, it works on windows as well as views.

Note that I have no idea what any effects in Windows 7 look like, since I don't use Windows.

0

精彩评论

暂无评论...
验证码 换一张
取 消