Masks in Sketch are used to selectively show parts of other layers. For example putting a circular mask on an image will only show the part in the circle.
Any shape can be turned into a mask. To do so, select the shape and go to Layer › Use as Mask in the menu. Any layers above the mask are clipped to its contents.
In version 3.4, you can now quickly apply a mask to bitmap images, simply by clicking the Mask item in the Toolbar. This will automatically generate a rectangle behind the image to which it is masked.
If you don’t want all subsequent drawing to be clipped, the best way to restrict the ‘influence’ of the mask is to put the mask and the layers you want clipped inside their own group. Anything above the group will not be clipped if the mask is inside the group.
Sometimes grouping is not an option. Another way to stop a mask is to do the following:
- Select a shape that is currently masked but that you don’t want masked
- In menu go to Layer › Ignore Underlying Mask
This layer and any layers above it won’t be masked anymore. Take care when you reorder layers as suddenly more or fewer layers can get masked.
Mask with Shape
If this all seems like a lot of work for masking an image, we have good news: Select a shape and an image on the canvas and go to Layer › Mask with Selected Shape to use the shape as a mask on the image. Sketch will put both layers inside a new group and turn the shape into a mask. Basically it automates the steps listed above.
By default a mask works by taking its surface area and hiding the rest. Another way to work with a mask is to give it a gradient, and to use the opacity of that gradient to determine what should be visible and what shouldn’t be.
This second mode is available for masks by selecting your mask and then going to Layer › Mask Mode › Alpha Mask.
To see masking in action – where everything on this page is explained, watch the video below: