Re: About nswindow animation?
Re: About nswindow animation?
- Subject: Re: About nswindow animation?
- From: PGM <email@hidden>
- Date: Sat, 10 Feb 2007 14:53:01 -0500
I am concerned about the animation effect implemented using nswindow.
For example, user click the red round button at the left up
corner, then I want to make my window fade out.
But using the NSViewAnimation Class, I can only capture the
NSWindow content view, that is,the content view in a window, no
the window self.
What you need to do is override your window's close method.
In your override of the close method, setup an NSViewAnimation
object with your window as the target (documented yes, but also non-
intuitive for a class called NSViewAnimation) and
NSViewAnimationFadeOutEffect as the effect.
When your animation has finished, call [super close] to actually
close your window.
You can also simply bypass NSViewAnimation and do in your NSWindow
subclass (typed in Mail, may need some tweaking):
- (void)close
{
float alpha;
while((alpha = [self alphaValue] ) > 0.0){
[self setAlphaValue:alpha - 0.2];
usleep((useconds_t)(1000000));
}
[super close];
}
Good luck, Patrick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden