Control transparency and animation
Control transparency and animation
- Subject: Control transparency and animation
- From: David Newberry <email@hidden>
- Date: Sat, 9 Nov 2002 15:36:02 -0800
Hello all,
For a little project I am working on, I want to create and destroy
buttons on the fly. When doing so, I'm going to want to also slide
other controls around and fade in/out the control being created or
destroyed. (This affect would be very similar to what can be seen in
the login window.)
So far I've gotten as far as creating controls on the fly. :) I'm
unsure of two things:
One is how to vary the opacity of a control. It seems that since the
NSButton class is a decendant of NSView it should be easy to do, but
I'm at a loss. I am thinking that controlling opacity would be simple
if I were doing the drawing myself, but as it is...
The other thing I'm uncertain about is the sliding around of controls.
Would it be acceptable to simply move them with a timer? My thinking is
that it would suffice, but I just wanted to check with my betters.
Thanks for any advice,
-David Newberry
P.S. For reference, this is the code for creating and destroying
controls that I'm playing with:
- (IBAction)create:(id)sender
{
NSRect r;
r = NSMakeRect( 50, 50, 100, 25 );
if ( !gButtonTest )
{
[NSButton setCellClass:[NSButtonCell class]];
gButtonTest = [[[NSButton alloc] initWithFrame:r] autorelease];
[gButtonTest setBezelStyle:NSRoundedBezelStyle];
[[myWindow contentView] addSubview:gButtonTest]; // gets
retained
}
}
- (IBAction)destroy:(id)sender
{
if ( gButtonTest )
{
[gButtonTest removeFromSuperview]; // gets released
gButtonTest = nil;
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.