Figma for Developers Aligning Objects
Transcript from the "Aligning Objects" Lesson
>> All right, so you're gonna flip over to an exercise real quick. And basically, cuz listening to me talk about how to move around the Figma UI is great and wonderful, highly recommended. Everyone should listen to me talk. But probably, a more useful kind of part of your time here is to just try a few things out.
[00:00:21] We're gonna get all the way into building drop down menus and buttons that hover and have all the states that we're used to in a UI. But if we are still struggling to get stuff where we need it, it's going to be a not fun time. So this is an initial kind of setup.
[00:00:39] The goal is to get a something like this. You don't need to get it exactly in the same position, I don't care. But ideally, we want to figure out how to kind of use some of these alignment tools as well. One of the things I would recommend that you do is press the Cmd or Ctrl key and go ahead and get that frame selected.
[00:01:00] And what you can do, you can work in this one if you want. You can also hold Option. You'll notice that when I hold Option or Alt, I can make a duplicate of any given layer and have a second version to work with it. We'll see some tricks that you can do with that in a second.
[00:01:16] But first, why don't you get comfortable with the tool that we're gonna use all day? And then we'll kind of do a whole bunch of these little extensions down here in a second, and we will learn a whole bunch of other little tricks as we go along.
>> How do I zoom in with hotkeys and not snap to 50% or 100%?
>> With hotkeys.
>> Is there a way?
>> I think that we all learn together is on a Mac pinching and zooming works. The same way works in the browser, you can do plus and minus, but it's got a big jump. The thing that we just learned together is if I hold Cmd + click on a frame and hit Shift to, it will zoom in to just that frame I'm looking at.
[00:01:54] Something that we all learn together. All right, so our mission here was basically to take the red rectangles and get them along the same vertical axis and distributed equally. And the blue rectangles as well. And then there were a whole bunch of little extension exercises hanging out down below that will kind of mostly complete our understanding of kind of moving around and moving stuff around in Figma.
[00:02:21] All right, so here's my kinda cloned version. Watch this, I'm gonna Cmd + click on there, I hit Shift+2, and it's going to zoom in just perfectly. Most of the time, I almost always want the sidebars. But if for some reason you do not, you can hit Cmd or I assume, Ctrl + ., and you can hide both sidebars if you need a little bit more viewing space, right?
[00:02:42] As we stream, I'm a little more zoomed in than I would normally be. So all that stuff kind of takes up a little bit more space than when I'm working on a 27 inch monitor at home, but both of those are options as well. Okay, so we have a few options here.
[00:02:55] We can click and drag, I can hit Select, we'll go see there's a whole bunch of other ways to go about selecting multiple things at the same time. But that's its own section, so I'm not going to talk about it right now. So for the distributing part, you can see that Figma has mostly figured out, it's kind of clippie, looks like you're trying to distribute things evenly, right?
[00:03:21] And it's like, yes, I am, right? So that one's pretty easy for us, and it gets those most of the way there. And you can see that when that happens, I get these fun little, I can change it and move it to get everything just the way that I want.
[00:03:32] So if you hold Shift, it'll go by increments of 10 as well. That's sometimes helpful depending on what you're trying to do, but I have that in place. Then the other part is getting them along the same axis. So I could go ahead and pick any one of these really that makes me happiest, right?
[00:03:49] That'll work, I can undo, I can do the center alignment as well. Depends on what I'm trying to do. The trick is usually to get either the center one in the right place on the axis that you're trying. Or if you're trying to distribute them, get the top and the bottom one, where you want them to go, and then you can kind of use the tools to do the rest for you, Mark?
>> Is there a way to find out the distance between two objects?
>> Yes, so the way to find the distance between two objects is you grab the starting position, and you hold down either Option or Alt. And then you can kind of move your mouse around, and you can kind of figure out what the distance is.
[00:04:28] Obviously, if it's just towards the edges, you'll see that. If it's kind of make a right turn main street, you'll see kind of both directions on your way there, I guess the fastest route, not really. But kind of both the x and the y axis to where the other one is.
[00:04:45] Again, these are the things that are not only helpful for getting your designs, right? But also when you are on the receiving end of these designs, very useful figuring out how far is that icon from the text in that button? All right, cuz previously, I would just like hit Refresh consistently.
[00:05:04] One dangerous thing that we will learn is the option key has two things. When we get to extension, I'll show you this again, which is holding the Option key and moving mouse around will show you all the distances. As we saw when we copied the frame, holding it while dragging will accidentally make you lots of copies, which I accidentally do more times than I would like to admit.
[00:05:27] So that's a thing that can happen as well. But if you find yourself accidentally making a copy, take your hand off the Option key, and you'll go back to just moving things, right? So just hands off and you can kind go back and figure stuff out as well.
[00:05:41] And you can also see as you're moving stuff around, it will show you the guides. If you are holding the Alt key, this is where I make the mistake all the time, it both duplicates and will also show you the kind of distance from when you started. So you just have to either, a, be careful to let go of the Alt key before you let go of holding down the mouse, or B, just be comfortable deleting the original.
[00:06:05] This isn't ink on paper, you can see the computer, you just change stuff. So both of those kinds of work in that sense as well. So here, I can align them by hand, distributing them is a little bit trickier. You'll see that it will snap as well, but I can also kind of select them all, get them mostly where I need them to be, not that one, and then distribute them or kind of change any of those pieces as well.
[00:06:34] So I can then distribute horizontally, and now they'll be even there as well. Let's go ahead and look at some of these extensions cuz some of these are useful and helpful, and we'll use them later. We did this one already, this is when you have things that are already kind of mostly aligned.
[00:06:52] You can grab the pink handle here and kind of evenly move them all around, so you're not doing one by one. And so we did that, cool. All right, this one's pretty neat. So you can also duplicate a layer by hitting Cmd or Ctrl + D, right? And that will duplicate one exactly where it is presently, which if you're not thinking it's the end of the day, it means you're forgetting, leave one on top of the other one, and then be, why didn't it duplicate?
[00:07:21] It did, just in the same position. That's never happened to me this week. The other thing you can do is if you hold Alt and you make that copy as we saw before, okay, cool, this is 24 pixels. That seems like a multiple of eight, I like 24.
[00:07:37] That's a good number, and let's say I needed to make a bunch of these red boxes. I could hold Alt again, try to get to another 24 pixels, or I could just do it and I can use those tools to distribute evenly, and then hope that they're all 24, and then adjust with the pink handle.
[00:07:53] Once I've dragged one with Alt, I can hit Cmd + D, and I'll make more of them of the same distance between the two layers of the last time I held Alt or Option and dragged. So that works as well, we got that one done. All right, we saw the ability to switch objects.
[00:08:13] So if I kind of put these in place here, let's grab some red and some blue. We'll go ahead and we'll distribute them, tidy up. You see these little dots in here, I can hold Cmd and effectively swap two items, right? So it'll just swap the position of both of them, and I don't have to move one and then try to remember where the other one was.
[00:08:42] Because when I was first learning this tool, did I write down the x and y positions in either a text editor or on a notepad? Maybe, do I ever want to do that again? I don't, right? And again, some of these things are the things that will get you from a frustrating.
[00:08:59] Cuz normally, this is all fine and good to do things the hard way until you have a deadline. So we've got that in place. We said before, if you hold Shift, it'll mostly stay along the axis unless it is fully snapping to something else. But if you're worried about just kind of going off a pixel, holding Shift and moving around will take care of that for you as well.
[00:09:21] And as we saw with a question earlier, if I hold Alt and move my mouse around, I can see the distance between two lines. We have one other trick for getting stuff aligned appropriately that is super useful, which is not on by default. But if I hit Shift + R, I get these rulers, which will kind of show me where stuff is in relationship to the x and y axis of the entire page that I'm looking at.
[00:09:47] But I can also drag from a ruler, either from the left side or from the top. I can drag the ruler out, leave a ruler in place, so I can leave it right here, and then I can go and just snap stuff over there as well. So yeah, that is kind of basically how you can kind of get stuff aligned, move stuff around, a bunch of the kind of tricks for duplicating, measuring, and stuff along those lines.