April 28, 2010 – 11:25 am
As most of you Flash developers most likely have experienced, Flash (and Photoshop for that matter) doesn’t create perfectly smoothed gradients!
The common trick is to apply a little noise in Photoshop (or similar) and save as an image.
The exact same idea was behind this “PerfectGradient” class. I simply wanted to be able to create gradient backgrounds with less banding and without loading a jpg/png.
Obviously this is not alway the best solution – sometimes you don’t want noise in the image and sometimes there is no banding problems with your colors – but for some cases, especially large background gradients, this could be very useful.
This class only supports rectangle gradients with two colors – either in linear or radial gradient style , but feel free to extend it. The syntax is easy, below is an example:
private var _linearBrightA:PerfectGradient = new PerfectGradient(500, 1000, 0xBBBBBB, 0xCCCCCC, Math.PI * .5, "linear", true, false, "lighten");
The parameters in the constructor are: width, height, color 1, color 2, gradient rotation, gradient style, use noise, use blur, blendmode for the noise and blur overlay.
Take a look here to see some different examples (click to switch between different examples). Every example has 3 PerfectGradients – one with only noise, one with both noise and blur, and one withoout any (clean gradient).
The banding issues are hard to see on small screen resolutions.
Download the example and class here
Hi, here’s just a brief update on what I have been up to lately and what’s to come soon.
Right now I’m working on a lawyer website for the Oklahoma based agency Quantus. It’s turning out great. I’m also finishing up a huge project for Human Design – a completely new complex website, of course with advanced deeplinking etc. This project is the latest utilizing my new framework.
I just finished developing and animating a banner for Zupa, for the Rock Cruise website. The challenge was animating the water in a realistic way, I think it turned out pretty good! I also just finished a new website for the talented guys at VplusA – it’s not online yet, but it’s coming soon.
A few weeks ago I also finished up designing an album cover for Dreamville together with Nicoline Graversen. We will be posting some pictures of the cover soon on her portfolio.
I also have the pleasure of being featured in a new book from Mao Mao Publications coming out in november. Thanks to Bjørn Djupvik for shooting some great photos of me and my office space for the book.
I was also very proud to see that I’m listed at Innovative Interactivity as one of 25 multimedia professionals to watch – thanks for that.
I’m also doing/finishing up projects for Designit, Infogalleri, Vidensbrønd, Wine and Surf, Kaare Viemose, What? and a few more – so it seems I have enough exciting work for some time to come.
That’s about it for now. I hope I can add some new posts to the blog soon – and also some of the source code I promised long ago.