Update: Illustrator CS4 now adds easy transparent gradients! We have a video showing the new Illustrator CS4 Gradient Annotator in action. If you are using an older version of Illustrator, read on for the tip below.
Here is a great question we recently fielded from an in-house designer at Pixar in California: "How do I fill an object in Adobe Illustrator with a gradient that goes from an opaque solid color at one end to transparent at the other end?"
Creating a gradient with transparency is so easy in Photoshop, you might assume the same would be true for Illustrator. However the process is somewhat more involved.
The answer involves using a special Opacity Mask to add a transparent gradient to your object. Once you understand how to use Opacity Masks in Illustrator CS and CS2, the effect is easy to reproduce.
Step 1: Create an object with a solid fill.
Use the color that you want to use in your future gradient. In this example we've drawn an orange rectangle with rounded edges.
Step 2: Duplicate the object, and fill with a gradient.
The easiest way to create a duplicate of your object exactly on top of itself is to copy it and then paste in front. There will now be two identical objects layered on top of each other.
Mac Shortcut: Command-C, then Command-F
Win Shortcut: Control-C, then Control-F
Now, apply a gradient to the top object using Illustrator's Gradient palette (Window > Gradient). The black areas of your gradient will soon become transparent.
Your screen should now look something like this:
Step 3: Create an Opacity Mask.
Finally, select both objects and choose Make Opacity Mask from the fly-out menu in Illustrator's Transparency palette (Window > Transparency).
Tip: If the top object is still selected, you can choose Select > Next Object Below to select the bottom item. Then hold down shift and reselect the top item as well.
Illustrator combines the two objects, using the top shape (the one with the gradient) as an opacity mask for the bottom one (your solid color). Leaving you with this result:
If you look back in the Transparency palette, you'll see a new opacity thumbnail appears to the right of your selected shape.
Step 4: Test the results!
Finally, you can test the opacity by drawing a solid box underneath your shape.
Bonus Technique One: Adjust the transparency later.
If you later find you want to adjust the opacity of your gradient, simply select the opacity mask icon in Illustrator's Transparency palette.
Select your object (you'll now be selecting the mask version with the gradient). And change the gradient settings in Illustrator's Gradient palette.
Bonus Technique Two: Multi-color Gradients w/ Transparency.
Once you have this basic technique down, you can create much more complex gradients. In the example below, we've selected our main shape (the original orange one) and filled it with a multi-color gradient from left to right. Then we switched into our opacity mask and adjusted the overall transparency gradient of our image to go up and down.
Source: Turns out our Pixar designer got our name off the Adobe website where our tips newsletter is featured in both the Illustrator Design Center and the InDesign Design Center resource links under "Blogs and Podcasts." Cool.