Stroke Width

This random stroke width Illustrator script offers users a fast and easy way to programmatically manipulate the stroke width across a whole set of objects. With four script modes to choose from — each with flexible settings — users can quickly iterate and create the designs they want.


Randomize Mode

Randomize stroke width in Adobe Illustrator with Randomill. Dial in a min/max, set up a step size, and just click ‘play’.

A grid of thin lines becomes a grid ofl lines of randomized widths.

Use a minimum and maximum value to randomize stroke width in Adobe Illustrator

Just set the min and max stroke width’s you’d like to see, and for each object in your selection, Randomill will randomly choose a stroke width from that range and apply it to the object.

Use a step size to further dial in your result

Adjusting the step size value can further narrow the range of stroke widths that might be randomly generated. For example, using a min of 0pt and max of 15pt with a step size of 5pt will ensure that randomly chosen values for the stroke width could only be between 0-15pt in increments of 5pts.

Decide how unstroked objects should be affected

Use the ‘Only affect already stroked objects’ checkbox to ensure that new stroke widths are only applied to objects that have a stroke. Additionally, if Randomill decides a stroke value for an object should be 0, use the ‘Values of 0 should remove stroke’ checkbox to make those particular objects unstroked.

Works seamlessly with text objects

Stroke width can also be randomized for point and area text, and can even be randomized within text objects on a per-paragraph, per-sentence, per-word, or per-character basis.

Applications and tips

Stroke randomization in Adobe Illustrator can be used to create or augment many kinds of designs, or to add some depth to a group of objects to make them appear as if they were farther or closer to the viewer based on their stroke thickness. This stroke randomization script for Illustrator combines well with the color and scale randomization as well.


Shift Mode

Loop through objects and incrementally adjust their stroke width to add detail to a field of objects.

A grid of thin lines becomes a grid of lines where the width of the lines gradually increases throughout the grid.

Shift an object’s stroke weight by a specific amount more than the object before it

This mode can be used to increasingly shift the opacity of an object in a set by a specified amount more than the previous object that Randomill has iterated over.

For example, let’s say you have four squares with a stroke width of 10pts and you shift the stroke width of these squares by 2.5pts. The result would be:

  • Square 1: Unchanged (10pt stroke width).
  • Square 2: Stroke width increased by 2.5pts (12.5pt stroke width).
  • Square 3: Stroke width increased by 5.0pts (15.0pt stroke width).
  • Square 4: Stroke width increased by 7.5pts (17.5pt stroke width).

You can restart the loop after some specified number of steps

If you only want to change the opacity of every other square in the selection, you can set this value to 1. This will result in every other square having it’s stroke width increased. This is because after every ‘1’ steps, Randomill will treat the next object it comes across as being the first object in the selection.

If you want to change the opacity of every square equally, and not gradually increase the opacity offset, set this value to 0. This will act like a ‘transform each’ operation, and every square will have it’s stroke width changed. This essentially acts like Illustrator’s built-in ‘Transform Each’ function, but stroke width is not one of the parameters in that function that can be explicitly set, it can only be scaled by a percentage.

You can also optionally include the first object to be included in the opacity shift operation as well.


Target Mode

Loop through a set of objects and set their stroke widths such that the last object in the selection (in terms of layer order) will have have the target stroke width.

A grid of lines of random widths has the widths of each line gradually transition from thick to thin throughout theg grid.

Example: say you have a series of 6 squares next to each other. The top-most square in the layer stack is on the left and the bottom-most square is on the right. All squares have a stroke width of 10 pts. If you select all these squares and set the target stroke width to be 0 pts, here is what the result would be:

Square 1: Unchanged.
Square 2: 8 pt stroke width
Square 3: 6 pt stroke width
Square 4: 4 pt stroke width
Square 5: 2 pt stroke width
Square 6: 0 pt stroke width

You can see that as Randomill iterated through the squares, it set each square’s stroke width to be a value to gradually approached the target value.


Oscillate Mode

Iterate over multiple objects in a selection and set their stroke widths to a value that bounces between two numbers of your choice.

A grid of thin lines transitions into a grid of lines where the width of the lines oscillates throughout the grid in a wave-like pattern.

Example: you have 10 squares lined up next to each other with the leftmost square being the top object in the layer stack. Each square has a stroke width of 1 pt. If you oscillate the stroke width of this set of squares from 0 pts to 6pt over 3 steps, you would get this result:

Square 01: 0 pt stroke width
Square 02: 2 pt stroke width
Square 03: 4 pt stroke width
Square 04: 6 pt stroke width
Square 05: 4 pt stroke width
Square 06: 2 pt stroke width
Square 07: 0 pt stroke width
Square 08: 2 pt stroke width
Square 09: 4 pt stroke width
Square 10: 6 pt stroke width

The first square was scaled by the From value, and took 3 Steps to get to the To value. Another 3 steps were needed to get back to the From value.