PDA

View Full Version : using animated icons in apps?




tominated
Jan 17, 2007, 09:23 PM
how would you go about making an animated (dock) icon for your app (like the xcode building icon or the adium icon)?



kainjow
Jan 17, 2007, 10:38 PM
For Cocoa, draw into an NSImage for each frame of your animation via NSTimer, then use NSApplication's setApplicationIconImage: method.

tominated
Jan 17, 2007, 11:21 PM
For Cocoa, draw into an NSImage for each frame of your animation via NSTimer, then use NSApplication's setApplicationIconImage: method.

ummm..... yes.... in english please?

kainjow
Jan 17, 2007, 11:29 PM
ummm..... yes.... in english please?

Are you trying to do this for your own program? Or someone elses?

tominated
Jan 17, 2007, 11:50 PM
Are you trying to do this for your own program? Or someone elses?

sorry, i am still a bit of a n00b with objective-c/cocoa. the aaron hillegass book was too hard for me to understand. don't bother. i don't need to have animated icons.

kainjow
Jan 17, 2007, 11:57 PM
sorry, i am still a bit of a n00b with objective-c/cocoa. the aaron hillegass book was too hard for me to understand. don't bother. i don't need to have animated icons.

Yes, you're going to want to learn the basics of Cocoa before you dive into animating the Dock icon, which, like I said, involves timers and drawing. Good luck :)

mduser63
Jan 18, 2007, 12:23 AM
ummm..... yes.... in english please?

Seriously, what kainjow suggested was rather simple. If you were unable to understand it, then you're definitely going to need more experience with Cocoa. You probably ought to go back and be persistent with Hillegass's book. Once things click, Cocoa programming becomes a lot of fun.

tominated
Jan 18, 2007, 01:58 AM
Seriously, what kainjow suggested was rather simple. If you were unable to understand it, then you're definitely going to need more experience with Cocoa. You probably ought to go back and be persistent with Hillegass's book. Once things click, Cocoa programming becomes a lot of fun.

i will try to understand it, but the only other languages that i am proficient at are english and xhtml/css. is there anything i should read before trying to understand the book? BTW: i can sort of, (barely) understand objective-c

iW00t
Jan 18, 2007, 02:01 AM
i will try to understand it, but the only other languages that i am proficient at are english and xhtml/css. is there anything i should read before trying to understand the book? BTW: i can sort of, (barely) understand objective-c

Do you understand OOP?

robbieduncan
Jan 18, 2007, 02:45 AM
Basically there is no one-line simple way to do this. It is up to you to update the icon at a reasonable frequency (too often and you'll consume a lot of resources, not often enough and it'll look bad).

You can either draw each frame in a graphics package, load all of the frames into your app as NSImages and set the dock icon to each in turn in a timer or load the base image into your app and draw on top of that using Quartz. The second method is probably better, but requires you to understand more about what you are doing.

tominated
Jan 18, 2007, 05:20 AM
Basically there is no one-line simple way to do this. It is up to you to update the icon at a reasonable frequency (too often and you'll consume a lot of resources, not often enough and it'll look bad).

You can either draw each frame in a graphics package, load all of the frames into your app as NSImages and set the dock icon to each in turn in a timer or load the base image into your app and draw on top of that using Quartz. The second method is probably better, but requires you to understand more about what you are doing.

what is this quartz thing anyway? i have wanted to know what the coregraphics, quartz, etc. are all about

robbieduncan
Jan 18, 2007, 05:23 AM
what is this quartz thing anyway? i have wanted to know what the coregraphics, quartz, etc. are all about

Quartz is the Mac OSX native drawing layer based on PDF. It's exposed in Cocoa via NSBezierPath and the like or you can drop right down into CoreGraphics which is a lower level representation of Quartz.

tominated
Jan 20, 2007, 01:34 AM
Quartz is the Mac OSX native drawing layer based on PDF. It's exposed in Cocoa via NSBezierPath and the like or you can drop right down into CoreGraphics which is a lower level representation of Quartz.

ummm.... yes...... :confused:

Catfish_Man
Jan 20, 2007, 08:48 PM
Quartz is what the system uses to draw. That simple enough?

<edit>
Also, AIDockController (which handles the animated dock icons in Adium) is a horrendous mess, and rather large. Nothing I'd ever inflict on a beginner.
</edit>

tominated
Jan 20, 2007, 11:43 PM
Quartz is what the system uses to draw. That simple enough?

<edit>
Also, AIDockController (which handles the animated dock icons in Adium) is a horrendous mess, and rather large. Nothing I'd ever inflict on a beginner.
</edit>

i see. lucky i don't need one.