Smooth corner rounding in Adobe Illustrator

sergey nikolaev
Bootcamp
Published in
10 min readOct 12, 2022

--

You may know that the default way of rounding corners — by simply inserting fragments of circles — is not the best of options.

Most primitive rounding of corners

Railroad engineers learned about this centuries ago when trains were falling off the rails due to sudden centrifugal force when they were passing from a straight section to an arc. They had to find transition curves in which the curvature (and centrifugal force) would grow smoothly.

In graphic design, such problems are much less popular, because attaching a piece of a circle to a straight line in a logo does not lead to a disaster with victims, you just get an ugly butt at the junction. But once you pay attention to such detail, you can’t stop seeing it — you notice these awkward connections everywhere, they stick out like bones in an open fracture or like Gigachad jaws.

Two versions of the Marusia voice assistant logo. On the left: the original version with simple rounding and, therefore, rude joints (shown by arrows). On the right: the corrected after some time version with the complete elimination of the straight sections.

Designers also have their own alternatives to the transitional curves, which allows them to round corners smoothly. The most popular example of the “correct” smooth corner rounding is the app icons in iOS.

image source

They are often used to explain the problem of rounded corners. For example, here is a typical picture from a typical article about the shape of Apple icons, showing how it differs from the usually rounded square:

Here the icon shape is called Squircle (aka super ellipse with parameters n = 4, a = b = 1). To be accurate, the shape of the icons at Apple are not really skittles…squirtle…squirсle and things are actually much more complicated than that, but we are not really interested in this quest for the Holy Grail. It is important to understand the difference between usual rounding and smooth rounding: usual rounding has a sharp jump in curvature at the point where a circle arc meets a straight line, and this lack of smoothness is quite noticeable, eyes stumble on this point as on an unfinished rude seam. With smooth rounding, the curvature increases gradually without any sharp jumps, and the straight line transitions to the arc seamlessly.

You can also think of a rounded corner as a trajectory of a car, and then the curvature at the curve point will show how much the steering wheel is turned when passing this part of the curve. Obviously, the driver’s steering wheel does not instantly jump from “straight ahead” to “90° right” and then back to the straight-ahead position in a blink of an eye. In reality, the steering wheel turns smoothly from straight to an extreme position and back, with no possibility of missing any intermediate turning angles. The natural and eye-pleasing corner rounding contains the same smooth “trajectory” of a line.

Explanatory picture with “Curvature Combs”. source

In the language of mathematics: ordinary rounding by embedding an arc provides continuity only for the first derivative (the curve turns smoothly without jumps), and smooth rounding also for the second derivative (the speed of the curve turns changes smoothly without jumps).

By the way, the same applies to three-dimensional space and the industrial designers: the conjugation with the continuity of the curvature of the first order (G1, the 3D equivalent of embedding an arc of a circle) causes an edge on a surface, collecting an unpleasant glare.

Surface matching: position, tangent, normal curvature, and second-order curvature for the perfectionists. source
As you have already realized, Apple is worried about the continuity of curvature. source

Smooth rounding in graphics editors — Figma and Sketch

But let’s come back to two-dimensional space. Part of the problem with curvature conjugation is the lack of a proper rounding tool. Rounding is much easier to implement by embedding pieces of a circle, so this method dominates wherever rounding is required: graphics editors, graphics programmers’ libraries, or the CSS border-radius rule.

Only in 2017 Sketch and later Figma (2018) introduced the ability to smooth corners. If we go into brief analysis of the proposed solutions, Figma has implemented this feature much better. First, Figma got it applied to a specific corner, not to the whole figure, which allows you to apply smooth rounding to any custom paths, not only to the “standard” shapes like rectangles, triangles, etc., as Sketch did.

In Sketch you can smooth the corners of the square, but not the drawn corner

Second, the measure of rounding is controlled by a slider in Figma, on the other hand it is a binary option in Sketch: either rounding smoothly or regular.

Corner smoothness control interface in Sketch and Figma

Actually, the whole topic of smooth corner rounding from a mathematical point of view was fully disclosed in Figma’s blog by an engineer, who was engaged in the implementation of this feature. From this post and the implementation interface itself, it is once again clear how developers and designers are passionate about finding the perfect rounded square “as in iOS icons” recipe, although smooth corner rounding will be helpful wherever there are rounded corners, not just in the form of app icons, and the corner in the iOS icon is not the only one providing curvature conjugation, it is just one of the possible options.

There is no perfect way to round a corner, it is a matter of taste, there is no need to fetishize one particular form chosen by Apple.

Smooth rounding in Adobe Illustrator

As for Adobe Illustrator, everything is sad here: slow and clumsy Adobe only added the usual rounding of corners (corner radius) in 2014, and as for the native smooth rounding there is nothing to dream about. But there are still ways to customize rounding in Illustrator:

Of course, you can manually move the corner point handles as you like. The minus here is in the manual processing of each corner and in the fact that this “as you like” can not be locked, each corner will be corrected a little differently.

Sergey Steblina suggested selecting the handles of the corner base points (but not the point anchors) and applying scaling to them. This method allows to correct all roundings equally and fairly quickly, but still, each corner must be processed individually. Also you can’t move points slightly backward to compensate for the visual reduction of the radius of the angle.

Scaling the handles: the rounding is smoothed, but the corner radius is visually reduced as well

Egor Chistyakov discovered a way to use a special Appearance magic with a the combination of the Warp effects to get a squirсle-like shape from a square.

There is also the paid script for drawing rectangles with smooth corners.

Finally, the latest version of the VectorScribe plugin includes a Squircular rounding mode, but without additional settings.

My smooth rounding script for Illustrator

I have been using my small self-written script to solve this problem since 2016, and only now I have found time to bring it to a relatively acceptable condition for public release.

The script itself does not round corners but tunes the existing default roundings. And let me tell you straight that my script does not give you that ideal rounding “like in iOS icons” simply because after you apply the smooth “Apple” rounding to achieve that desired corner shape it creates four Bezier curve points per corner in Sketch and Figma. Vector in the official Apple interface library also contains four points per corner:

I didn’t want my script to add extra points and limited it to gently adjusting of the handles of the already existing rounded corner points only. That is why the script does exactly two things: pulls the line-arc conjugation points slightly backward from the corner and slightly pushes their handles forward. It looks something like this:

Changes of corner shape and the curvature profile when the points and their handles are shifted

Therefore, the script has two parameters: how much to move the point away from the corner (Anchors coef) and how much to move the handle backward (Handles coef).

Even without adding additional points, the script solves the problem: butt junctions are smoothed and curvature does not grow so quickly. Two variables are enough to cover a wide variety of corner shapes from flabby to tight, from carefully tweaked to completely new shapes:

In fact, the two sliders distribute the area of a corner curvature profile — spread uniformly over the entire corner or collect into a hump.

Of course, the script can process all corners of an object at once:

Or just the selected ones:

Or even all the objects at once:

I understand that two parameters in the script that don’t clearly affect the result are not the most user-friendly or intuitive options compared to the other tools (the single slider in Figma and the on/off switch in Sketch and the Vectorscribe plugin). But I decided not to try to combine them into one parameter or checkbox, stealing the accuracy of the setting. This script is, after all, a small professional tool, not a product.

So instead of a “Make It Cool Like Apple” button, I suggest that you play with the sliders, pick the right combinations of coefficients, and save them to presets. For example, a transport schemes designer can make different rounding presets for all occurring angles of turns in the scheme: 30°, 45°, 60°, 90°, 120°, 135°. Some presets already come with the script, and you can delete them if you don’t need them.

I also added a checkbox to run the script silently, so that the settings panel does not annoy you when the script has to run every time with the same parameters and there is no need to change anything. The script is then executed without a popup with the last used values of the coefficients. The settings panel will appear when you run the script with the Shift key pressed. Since this is the question I have to answer most often, I will especially highlight this point: If the settings popup does not appear when you run the script, try running the script again while holding pressed the shift key.

UPD: Previously, it was written here how to find the variable in the code that is responsible for displaying the curvature profile. Since version 0.0.4 of the script, released in October 2022, a curvature profile display checkbox has been added to the popup.

Control panel since version 0.0.4. There is a curvature profile checkbox.

I did not put the rest of the parameters in the interface, but they can be changed in the code.

Link to the script

GitHub repo: https://github.com/kefiijrw/Round-Corners-Customization-for-Illustrator.

Or just a download link:https://kefiijrw.com/upload/Round Corner Customization for Illustator.zip

Please write bug reports or suggestions to the repo, or if you can’t, then to telegram or email jjj@kefiijrw.com.

Bonus. How to run scripts for Adobe Illustrator

Ok, this shouldn’t have been part of the story, but… using scripts in Illustrator by default is pretty annoying (and lazy). It’s the bottleneck of the whole design automation routine, but if you get past it by taking time to set up a comfortable running script once, the real party begins. So I will list all the options for launching the script, and you will choose your own level of difficulty (or laziness).

Method 1. “Lazy as hell, stubborn as Satan”
Simply drag and drop the script file into the Illustrator window

Method 2. “Fan of dialog boxes”
Click File → Scripts → Other Script… and then search for the script file in the depths of the file system.

Method 3. “Triumph of the Will”
Once to force yourself to put the script file into /Applications/Adobe Illustrator [vers.]/Presets.localized/en_GB/Scripts (MacOS) or C:\Program Files\Adobe\Adobe Illustrator [vers.] (64 Bit)\Presets\en_GB\Scripts\ (Windows), restart Illustrator and then you just need to click on the script in the File → Scripts drop-down menu.

Method 4. “Almost a programmer”
After adding a script to the menu (the previous method), write an action that runs the script. You will need the Insert Menu Item… thing on the Actions panel drop-down menu. It lets you add to the action the execution of any item from the application menu. And since after the previous method, the script is already in the File → Scripts menu, it is named along with all the other items.

After that, you can run an action not by double-clicking in this panel, but by single-clicking if you switch the action panel to Button Mode.

But for my taste, it’s best to set up a shortcut for the action.

Method 5. “ The Customizer”
Install one of the plugins that allow you to run a script in one click from a special panel. Some of the ones I know: JSX Launcher, LAScripts, Script Bay, Scripshon Trees, SPAi, Sppy.

--

--