Design

Accurate and editable radial progress bars in Sketch

by

on

View all posts

[Download the corresponding Sketch project file here.]

Drawing a radial progress bar in Sketch may not be difficult, but creating one that’s easily editable and mathematically accurate is a different story.

Fortunately we’ve got some tricks, and some math, that’ll make your life a whole lot easier.

For those who prefer reading to watching, get the step by step below the video.


1. Create a circle

To see the finished product and poke around with it, download the Sketch project file here.

Sketch tutorial

We’ll start by creating a simple circle by grabbing the oval tool, holding shift on the keyboard, and dragging one out. To make things a little easier down the road, let’s also set the size to a nice round number like 400×400.

Sketch tutorial

A little further down on the Inspector, we’ll also turn off the fill and turn on the border. While we’re here, go ahead and fatten up that border a bit and give it a color you like. I’m gonna go minty fresh with it.

Related: Save hours with these 86 Sketch shortcuts

2. The dashed border trick

Here’s where things get interesting. We’re gonna take control over the length of this ring by turning it into a dashed line—with one big, fat dash.

Sketch tutorial

Click the gear and type “9999” into the first box labeled “Gap.” This is going to ensure that we don’t end up with 2 “dashes” coming together, which would make our ring the wrong length.

Sketch tutorial

Want to freehand things? Click in the first “Dash” box, hold the shift key, and then start pressing or holding the up arrow on the keyboard to add length. You’ll see the ring coming around and can dial it up to where you want it.

Sketch tutorial

If you’d like round end caps at this point, you’ll want to click the round “Ends” icon, but also change the border position from “Inside” to “Centered.

Learn Sketch

4. Getting mathematically accurate

Chances are, you’re creating these rings to visualize data—like a percentage. In that case, it’s pretty important for the ring to be an accurate representation of that data.

Here comes a little math. Don’t worry—Sketch happens to double as a calculator.

Sketch tutorial

In order to convert a percentage into a perfectly accurate ring, head back to the “Dash” field and type your numerical percentage as a decimal value (i.e. “.75” for 75%), then an asterisk ( * ) to multiply by the height/width of your circle (i.e. “400”), then *3.14 to multiply by pi. It might sound intense, but you’ll find the formula written out below for easy reference.

Hit return, and you’ve got your perfectly accurate ring.

Formula for dash:
. Percentage * Circle Height * 3.14

Example:
.75*400*3.14

5. Rotating and scaling

At this point, you can flip and rotate your ring however you’d like. But if you drag to scale your circle, the math will no longer be correct and you’ll have to redo it.

Sketch tutorial

If you instead choose Scale from the toolbar and enter a new size, Sketch will automatically refactor the math on all applied effects.

Now all you have to worry about is the border width.

Looking for more Sketch tutorials?

How to override colors in Sketch
Creating infinitely scalable connection arrows in Sketch

What are you designing with Sketch? Tell us on Twitter: @InVisionApp.

Author

Joseph Angelo Todaro

Video Producer at InVision, former UI/UX designer of international in-flight entertainment, and avid automotive enthusiast.

Join over 3 million designers

Who get our content first.

No sales pitches, no games, and one-click unsubscribe.

Over 3 million designers
get our newsletter
every week

Find out why

Get awesome design content in your inbox every week

Just like over 3 million of your fellow designers do.

Plus get 3 free downloads, just for signing up.

Give it a try—it only takes a click to unsubscribe.

Thanks for signing up!

You should have a thank you gift in your inbox now—and you'll hear from us again soon!

Prototype better experiences with InVision

Just like over 3 million of your fellow designers do.

I agree to InVision's Terms of Service.

Want a free t-shirt?

Join the 3 million+ designers who get our newsletter weekly for your chance to win!

We hate spam as much as you do, and you can unsubscribe anytime.

Double your chances to win!

Tweet and automatically get a second entry

Tweet Now

No Thanks

Stay in touch!

We share news, freebies, and more on Twitter.