Just like on any design tool, designers can mask elements using shapes. Select the element to be masked and the shape to be the mask, and go to Edit > Mask with Shape. To edit, double-click and make a change to the mask or to the element being masked.
- [Instructor] Let's create a new document here to learn how to play with masks in XD. First of all, I will import an image. So file, import, I'll pick this one. Zoom out a little bit. And let's say I will have this shape, and I'll just play with that a little bit. Something like that. And this will be my mask. A happy mask. (laughs) So, with my image in that shape, I can go to object, mask with shape.
And now that image is now masked by that shape. I can then double click to edit where my image is or I can even play with the mask, making it a different path. And as you can see there, as soon as I click outside I commit and I get there. So, another example is if I have another image, let's import another one.
That's my face and I wanna do a profile. I just draw an ellipse there, select both elements, apply the shortcut, on the Mac its command shift M, on Windows it's control shift M. And now I have that as a mask. And if I need to adjust where it is, I just double click and I can play with my object or with the shape that's masking this object. One thing to note here is if I open the layers panel, I can see that this is a mask group.
And if I expand, I can see the two elements that make that mask. Same there, I can see the two elements that make that mask. We cannot have, for example, gradients in text in XD. For example, XD is cool. Something like that. And there is no way so far, to have a gradient that goes from this side to that side. But I can mask it to get to that result.
So one thing that you have to do before you get there, you need to convert this text to a path. So I go to object, path, convert to path. So now this is no longer text, this is a set of anchor points and a very complex path. Now I can draw that rectangle that will be my element. I can right click and send this to the back. And now let's play with a very nice and colorful gradient.
So I'll make something very vibrant like that. And as we learned before, I can play with gradients on canvas. And now with that shape and this guy selected, I can go to object, mask with shape, and boom I get that text with this gradient behind. So this is how you mask elements, not only shapes with shapes but also bitmaps with shapes.
So go ahead and play with masks.
- Understanding all tools in Design mode
- Bringing files for Photoshop, Illustrator, and Sketch
- Working with text, vectors, image fills, and masks
- Repeating elements with the powerful Repeat Grid tool
- Resizing multiple elements with responsive resize
- Using the new Assets panel to manage symbols, colors, and character styles
- Sharing symbols across files, with text and image overrides
- Creating and consuming bitmaps and vectors from CC Libraries
- Extending the power of XD using great plugins