1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

using animated icons in apps?

Discussion in 'Mac Programming' started by tominated, Jan 17, 2007.

  1. macrumors 68000

    tominated

    #1
    how would you go about making an animated (dock) icon for your app (like the xcode building icon or the adium icon)?
     
  2. Moderator emeritus

    kainjow

    #2
    For Cocoa, draw into an NSImage for each frame of your animation via NSTimer, then use NSApplication's setApplicationIconImage: method.
     
  3. macrumors 68000

    tominated

    #3
    ummm..... yes.... in english please?
     
  4. Moderator emeritus

    kainjow

    #4
    Are you trying to do this for your own program? Or someone elses?
     
  5. macrumors 68000

    tominated

    #5
    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.
     
  6. Moderator emeritus

    kainjow

    #6
    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 :)
     
  7. macrumors 68040

    mduser63

    #7
    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.
     
  8. macrumors 68000

    tominated

    #8
    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
     
  9. macrumors 68040

    iW00t

    #9
    Do you understand OOP?
     
  10. Moderator

    robbieduncan

    Staff Member

    #10
    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.
     
  11. macrumors 68000

    tominated

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

    robbieduncan

    Staff Member

    #12
    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.
     
  13. macrumors 68000

    tominated

    #13
    ummm.... yes...... :confused:
     
  14. macrumors 68030

    Catfish_Man

    #14
    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>
     
  15. macrumors 68000

    tominated

    #15
    i see. lucky i don't need one.
     

Share This Page