How to create a polyline in illustrator, with each edge a different color?


I have a sequence of thick segments of different colors, which overlap at the end points. It looks like this:

enter image description here

I would like it to look more like a single path, like so (note the change in the corners):

enter image description here

Is there a simple way to do this with illustrator? I can manually convert each segment to a rectangle, and then move their vertices to get that effect, but perhaps there is a more direct way?

5/27/2014 11:48:00 AM

If it is a regular polygon, you can use Adobe Illustrator and the gradient as in the answer suggested by Ilan and set each pair of middle stops to be at the percentage defined by the division of 100% and the number of sides of the polygon.
In an hexagon, that will be 16.67%, 33.34%, 50%, 66.67% 83.34%. In trying to answer the question, I discovered that it works best if they are not in the exact same position so I gave a 0.01% difference to each middle stop, in this sequence:

  • Color A first stop: 0%
  • Color A second (middle) stop: 16.66%
  • Color B first stop: 16.67%

And so on.

For the gradient to reproduce the angular bisector, you have to select "Apply gradient along stroke" (please correct this if needed because I'm translating from the Spanish version of AI).

hexagon with gradient stroke

gradient pane

4/13/2017 12:46:00 PM