Combining the features of a clipping mask and a layer mask, Adobe Illustrator's opacity mask allows designers to control the transparency of an image or shape. Using a gradient like white to black, you can create an opaque effect that builds in intensity and masks the image below.
Below, we've outlined how to use the opacity mask in Illustrator. For this hypothetical project, we'll be applying the mask to a basic square shape.
- Start a new project in Illustrator, and set the background layer to a dark color. This will make your opacity mask more visible. You can lock the background color by pressing Command+2 (or CTRL+2).
- Next, draw a simple square on a new layer, and fill it with a contrasting color. To create a mask on this shape, find the Object tab on the top menu and choose "Path" > "Offset Path". A new box will appear with offset path settings, so enter an Offset of 2 px and select "Miter" from the Joins section. Then, click OK.
- Now, Illustrator will use the offset path settings to create a new shape, placed on top of the original shape and 2 pixels bigger on each side. Before moving on to the next step, check the Layers panel make sure that your new shape is the top layer. If not, drag it to the top of the list.
- This new shape will be our opacity mask, so select the shape and choose the Gradient box in the Tools panel. Select a black to white gradient, or any gradient you prefer. Once the gradient is applied, select both shapes by clicking and dragging over them.
- Finally, go to the Transparency panel (you can enable it by selecting "Window" > "Transparency") and click the top right arrow. Then, choose "Make Opacity Mask" from the list of options. Illustrator will analyze the gradient and adjust the original shape accordingly. Any white areas of the gradient will become opaque, the dark areas will become transparent, and the grey areas will fall somewhere in the middle.
Masking a basic shape is definitely useful, but the opacity mask in Illustrator also works with complex illustrations and photos, so feel free to experiment! You can apply an opaque gradient to your entire image, or just certain sections that would benefit from transparency.