Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Dock Animation: How to do it?

Dock Animation: How to do it?
Thread Tools
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Nov 11, 2002, 04:22 PM
 
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
Reply With Quote
Nov 11, 2002, 07:53 PM
 
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.
Rick Roe
icons.cx | weblog
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Nov 11, 2002, 08:08 PM
 
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
Reply With Quote
Dec 6, 2002, 07:42 PM
 
So how does Mail draw their numbers in the new messages badge?
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Dec 6, 2002, 09:15 PM
 
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
Reply With Quote
Dec 6, 2002, 11:11 PM
 
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
Reply With Quote
Dec 7, 2002, 02:35 AM
 
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
Reply With Quote
Dec 7, 2002, 04:49 AM
 
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
Reply With Quote
Dec 7, 2002, 01:15 PM
 
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
Reply With Quote
Dec 7, 2002, 01:39 PM
 
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
Reply With Quote
Dec 7, 2002, 07:51 PM
 
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
Reply With Quote
Dec 8, 2002, 01:06 AM
 
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
Reply With Quote
Dec 8, 2002, 01:50 AM
 
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'."
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:19 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2