• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Control transparency and animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Trouble making a table become first responder in key loop
  • Next by Date: Dragging and resizing controls
  • Previous by thread: Re: Trouble making a table become first responder in key loop
  • Next by thread: Dragging and resizing controls
  • Index(es):
    • Date
    • Thread