Creating Patterns In Sketch
Saving disk space while avoiding copy & paste headaches.
In this tutorial, we’re going to go over the basics of creating a geometric, or repeating, pattern. With Sketch’s ability to create tiled fills in shapes, the geometric patterns we create can take up any amount of space, and create a seamless fill in any type of shape — whether it be a circle, a square, or an irregular polygon.
PART ONE : CREATING A BASIC PATTERN
To start, we’ll create a basic non-overlapping pattern, just to get our feet wet. Let’s open up sketch and create a 100x100 pixel artboard. You can do this by tapping A on your keyboard and while holding shift, click and drag to create the artboard.
This artboard will hold the pattern that we wish to repeat. The artboard doesn’t have to be this size, or even a square, but in order to keep this tutorial simple, we’ll keep it this size. For the first pattern, we’re going to create something like this…
Nothing overlaps, and it’s pretty clear what is going to sit inside the square we just created. So, let’s create a background color. To do this, with the artboard selected, you should see the option to add a background color on the right-hand side panel of your sketch window. Make sure that is toggled on, choose the color you want that to be (I’m using #E6E1DD), and finally, make sure that the “include in export” toggle is selected. Without that, when we try to create the pattern the background color we just made will be missing.
After adding the background color, we can add the shapes that make up the actual pattern. The first object we’ll create is a 40x40 pixel circle in the middle of the artboard. I have mine set in #C59144.
Following the circle, we’ll add the triangle. I find the easiest way to do this is create a 100x100 pixel rectangle, double-clicking the shape, selecting the top-right corner, and hitting delete on my keyboard. I have this shape set in #2A3141.
Now that we have the foundation of the pattern ready to go, we can export something that will allow for us to use this in any design we’ve working on. Select the artboard that contains the pattern, and in the bottom section of the right-side Sketch panel you should see the option to make this artboard exportable. Click on that to bring up the export options. We’re going to save this as a 1x PNG named something along the lines of “pattern_01.png”. Or, you can name it whatever you think works best for you. Save it somewhere you will be able to easily access it, for the purpose of this tutorial, I’m saving it in a folder called “Patterns” on my desktop.
Finally, we can use the pattern we created. Draw either a circle or a rectangle, (or any other shape your heart desires) anywhere in your sketch file. Instead of giving this object a fill color, we are going to give it an image fill. To do this, click on the fill options’ color, and look for the icon that resembles your iPhone’s photos app icon (or for you Android and 15 Windows phone users, the one that looks like a flower). Click on that, select “Choose Image” and navigate to and select the pattern we just created. Once selected, the object you created should fill in with the pattern you made.
From here, we can play with the size of the pattern, making it smaller or larger; however, if you find you need to increase the size too much, the pattern may become pixelated. If that’s the case, i’d export the pattern again, but this time maybe at 2x or 3x.
PART TWO : CREATING OVERLAPPING PATTERNS
Now, let’s say you want to create a pattern where there is some overlap like the example below. To do so, you’ll need to work in a bit of math as well as take some time to experiment a bit. Of course, the more you do it, the easier creating patterns like these will become.
To create a pattern like this, we’ll need to do a little math. Because there is no true start or edge to the pattern like the one above, we have to pick a section to create. In order to make sure that the pattern repeats and has no seams, the left side of our pattern’s artboard needs to be a continuation of the right side of the artboard, and the top needs to be the same for the bottom. To make this as easy as possible, I find taking the object that is overlapping, and having it’s center-point be on the break the easiest — all I then need to do is make sure the object on the left edge has the same Y height as the object on the right.
You can test to see you pattern is correct by simply copying your artboard, and placing it either next to or above/below your first artboard.
Obviously there are much more intricate and complex patterns you can create, but hopefully this gives you a little bit of a head start when it comes to creating your own.
Have questions? Comments? Corrections? Want to get in contact? Feel free to shoot me a tweet and/or check out the work that my co-workers and I are producing over at Intrepid Pursuits as well as the rest of the team’s thoughts regarding the mobile world.