Monday, 18 July 2011

Glass Button Generator

Was looking for ways to draw those nice glass buttons on the net, found this link from Anders Brownworth which not only generates a beautiful glass button, it also saved it as a .PNG file which you can then re-use in the future, which is pretty cool!

Played around with it a bit, and added some looping and tried to covered lots of colours (colorWithHue accepts value from 0 to 1 only)  and when executed will almost fill up the screen with glass buttons in different colours as shown below. Now I didn't spend lots of time in the calculation to make sure it covers all of the numbers, so you are welcomed to adjusted the parameters to different sizes and colours.

Also, before you run the code, please be aware that the following line controls where should all the image buttons be saved/written to your local drive and you should change it according to your system.

tmpStr = [tmpStr stringByAppendingFormat:@"/Users/qq/tmp/testButton%d_%d.png",ii,jj];

Then you will see lots of nice glass button files ready to be re-used in other projects.

Have fun!

Source for Glass Button image Generator

No comments:

Post a Comment