The Power of Appearances

The other day I managed to pull off a fairly complicated Illustrator effect that I was rather proud of, and I wanted to share it today with all of you and talk about how I did it. While you may not ever want to reproduce this exact effect, hopefully it will give you an idea of the power and flexibility of a couple of my favorite parts of Illustrator: appearance attributes and knockouts. I talked about these two particular things in a recent post, and so if you’d like a little background, head on over there first. Here, I’ll be working from the assumption that you’re familiar with these concepts.

Quick Background

I have been working on a series of ecological maps for a client, and one of the things they show is the range of various species: either their total annual range, or their range for a given season.

range-style-01

The client then asked me to develop a way to show both at once, where the seasonal range edge overlaps the total range edge. So, this is what I came up with, and what I’ll break down here.

range-style-02

Walkthrough

Let’s start with a blue dashed stroke. It my case, it’s 16pt, with 10pt dashes and 5p gaps. And I’ve set the dashes to align to corners and ends so that they look a little tidier.

range-style-03

I really only need an inside stroke here, rather than ones that goes on both sides of my path. But, you for some reason can’t do an inside stroke in Illustrator if you’re also using the “align dashes” setting. And I do want to keep the dashes aligned, because they tend to look a little nicer and more even in my opinion.

So, to work around that, I will add another stroke on top (9pt), this time solid and outside.

range-style-04

Then I’ll set it to 0% opacity, and turn on Knockout Group for the whole object appearance. So, now the outside portion of our dashed line is gone. If any of this is unfamiliar, I would again recommend reading this post, which will give you a hopefully-adequate sense of how appearance attributes and the Knockout Group setting work.

range-style-05

So, now I’ve got the blue portion of the stroke finished. Let’s add the grey portion on the outside. I’ll add another stroke, this one grey, 4pt, and with the same dash pattern.

range-style-06

Only the portion that’s inside the path shows up. The outer portion gets knocked out by that outside stroke we set up, above.

Here's what it looks like with the outside stroke turned off.

Here’s what it looks like with the outside stroke turned off.

Now, I want a little gap between the two strokes. Let’s start by creating a new, 0.5pt stroke. Color doesn’t matter, but I’ll make mine red to stand out.

range-style-08

Now, I use the Offset Path effect to shift this thing inward by 1.75pt.

range-style-09

And then I set it to 0% opacity. Since we’ve got Knockout Group on, it knocks out the stuff underneath, leaving a 0.5pt gap between our grey and blue strokes.

range-style-10

For the final portion, I want to make these dashes fade away as they get toward the center of the shape. I like the softness of the look, and to me it also imparts the idea of “the species stays on this side of the line,” which is important when the shape is large enough that the reader might not always be able to see the whole thing at once.

I start by adding a fill on top of everything, and offsetting it inward (2pt in this case). This means the fill doesn’t start until just after the gap. Right now it’s covering the blue stroke.

range-style-11

Next I apply a 4pt feather to the fill to cause it to fade at the edges. Make sure to add this feather after (below, in the order of appearance layers) the Offset Path effect.

range-style-12
And then I set the fill to 0% opacity. Because of the Knockout Group setting, the blue stroke fades out as the invisible fill fades in.

range-style-13

And that’s the effect! Here it is in use on an actual map:

Context.png

It does not always look great when going around hard bends or corners, but I don’t generally have those in the situations where I’m using it, so I don’t mind. Dashes often get pretty tricky in those situations.

range-style-14

The nice thing is that this is all one object. You could achieve a similar look by creating multiple paths all stacked on top of each other, but by doing it all on one object, it’s more flexible. If the shape needs to change, you don’t need to update multiple copies, each with its different stroke styles.

Again, I imagine that you probably won’t ever need to reproduce this exact style. But I hope this step-by-step gives you some ideas as to what sorts of cool things you can do by messing around with appearance attributes, knockouts, and effects.