using animated icons in apps?

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

  1. macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #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

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

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #3
    ummm..... yes.... in english please?
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Are you trying to do this for your own program? Or someone elses?
     
  5. thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #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

    Joined:
    Jun 15, 2000
    #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

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #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. thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #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

    Joined:
    Nov 7, 2006
    Location:
    Defenders of Apple Guild
    #9
    Do you understand OOP?
     
  10. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #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. thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #11
    what is this quartz thing anyway? i have wanted to know what the coregraphics, quartz, etc. are all about
     
  12. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #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. thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #13
    ummm.... yes...... :confused:
     
  14. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #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. thread starter macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #15
    i see. lucky i don't need one.
     

Share This Page