An opacity mask is a curious hybrid of the layer mask function in Photoshop and the clipping mask function in Illustrator. Although the implementation of this feature is a bit confusing, once you understand it, opacity masks could become one of your favorite features in Illustrator.
What’s an Opacity Mask?
Unlike regular masks, which are defined by the physical area and shape of a vector path, opacity masks (like Photoshop’s layer mask) are defined by the positive (white) and negative (black) space, or any shade or gradient in between. This means your mask can be defined by a soft edge, gradient, or black and white piece of artwork—even photographs. If you’ve ever tried to unsuccessfully overlay two gradients on top of each other, or fade a gradient into two or more different colors, then opacity masks are made for you.
Where Is the Opacity Mask?
Instead of a whole new palette just for opacity masks, the feature is located in the Transparency palette—most likely because there is some “transparency” involved. Whatever. To access opacity mask options, click the arrow in the right corner A of the Transparency palette to open the palette menu and choose Show Options B.
Create an Opacity Mask
To create an opacity mask, make an object and place it on top of the object(s) you would like to mask. Fill the top object with a gradient A. Although opacity masks can be filled with any color, it’s best to use black and white. When made into an opacity mask, colors will be translated to their grayscale equivalent anyway, so instead of guessing how a color will translate, you might as well start off in black and white. Now select both objects B and on the Transparency palette menu choose Make Opacity Mask C (no, there isn’t a shortcut key or menu item—this feature is very well hidden). The result is an object that fades to nothing D. If you place a gradient filled object below the opacity masked object, the object with the opacity mask will blend right into it E!
Using Opacity Masks
Working with opacity masks after they are created can be a little tricky. Familiarity with how layer masks work in Photoshop is helpful since there are many similarities. When you created the opacity mask, a thumbnail appeared to the right of the thumbnail of the artwork that was masked A. As in Photoshop, this thumbnail represents your mask. White represents the area of an object that is visible from underneath the mask, and black represents the area that is “knocked out.” Areas that are 50 percent black, for instance, will make the object that is being masked have a 50 percent opacity.
The two main settings for opacity masks are Clip and Invert Mask. The Clip option, which is turned on by default, defines the visible area of the opacity mask and the object it is masking. If the Clip option is turned off B, the masked area is defined by the opacity mask object, but the area around the object is also visible. This means that if artwork goes beyond the object that is defining the opacity mask, the artwork will be visible and will not be affected by the mask, whereas the overlapped area will remain affected by the mask C. When the Clip option is turned on, the opacity mask object, just like a normal mask, defines the visible area.
The other opacity mask option is Invert Mask D, which, as the name implies, reverses the opacity mask effect E.
Modifying Opacity Masks
You can modify an opacity mask in two ways. The first option is to select the artwork to which you applied the opacity mask. Then, while selected, click the opacity mask thumbnail in the Transparency palette A. This changes the focus from the left-side object thumbnail to the right-side mask thumbnail (as in Photoshop). You’ll notice that the layers in the Layers palette have changed, and that they’ve been replaced by a single opacity mask layer B. Don’t worry! Your artwork and layers haven’t gone anywhere! The changes merely reflect that you are now in a separate “opacity mask mode” where anything you modify, create, or delete affects the opacity mask but nothing else. While in this “mode” you can modify the opacity mask by adding objects (remember to use black and white artwork) or changing the stacking order C. The main problem with this option is that while the masked artwork is visible, the opacity mask is invisible, making it difficult to manipulate.
The second option for working with opacity masks is to Option (Alt)-click the mask thumbnail, which will again put you into opacity mask “mode.” This time, however, you will see the black and white artwork that composes the opacity mask. With this option you can see exactly how your mask is defined D. The downside of this option is that no other artwork is visible, and while you are manipulating the mask you won’t have any context on how it is affecting the object(s) it is masking.
To exit opacity mask “mode,” click the artwork thumbnail E (again, like Photoshop), which brings you back to the regular artboard, making all your layers reappear.
By default, the opacity mask and artwork are locked together, causing the artwork and mask to move together. If you want to move the mask and the artwork independently, unlock the button in the middle of the two thumbnails F.