 |
 |
Dock Animation: How to do it?
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
Is the best way to have a timer which when fired changes the application icon? So that if I had a dock icon that was animated, like iSync, I would include in my project 20-30 images and the timer would change them (using setApplicationIcon:) so that it animates?
Is there a better way to do it?
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
Yeah, that'd work. It's pretty much what I did for JARED.
Depending on what kind of animation you're doing, you might find it more efficient to generate your images at run time than to include a whole bunch of TIFFs in your app wrapper. For example, an effect like the pulsing default button could be created using two images and some fading between them, or a spinning animation could be generated from a single image and some graphics context transformation.
Remember, if you're thinking about implementing Dock icon animation in your app, consider the usefulness versus obtrusiveness factor.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
Thanks again Rickster. I may or may not add the icon animation in my app. If I do, I will make it so that the user can turn it off in the prefs.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
So how does Mail draw their numbers in the new messages badge?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Also, keep in mind that if you do something like this, your app is going to show high CPU usage numbers. That's important to some people.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status:
Offline
|
|
Originally posted by macrophyllum:
So how does Mail draw their numbers in the new messages badge?
it has a base icon, and then three badges ( for 1 digits, 2 digits, 3 digits) that are red... then, on top of those badges it adds the number....
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
So how does it add the number? There aren't images for each number are there? I couldn't find any so I thought it "drew" them on the image during runtime.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: May 2001
Location: Massachusetts, USA
Status:
Offline
|
|
It does. If you wanted to get really fancy, you could dynamically generate the entire icon in code as a bunch of regions, lines, text, etc. I wouldn't recommend it, but it's possible. 
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
So how hard is it to just generate the numbers on the badge like in Mail?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status:
Offline
|
|
does anyone know the right stuff to sift through the MAIL code? 
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Originally posted by macrophyllum:
So how hard is it to just generate the numbers on the badge like in Mail?
Drawing numbers onto an image is trivial. Like so:
Code:
NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(50, 50)];
NSString *string = @"5";
[image lockFocus];
[string drawAtPoint:NSZeroPoint withAttributes:nil];
[image unlockFocus];
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
That is cool. One last question, how do you change text size, color, etc?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Originally posted by macrophyllum:
That is cool. One last question, how do you change text size, color, etc?
The attributes dictionary.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|