# Illustrator: how to create a spirograph?

I am trying to create a spirograph in Illustrator, as per attachment. How do I do this? Where do I start?

Ok, so a spirograph is just a function and I have made a function drawing script called jooGraphFunction. With this tool at hand we can go and plot

``````cos(2*t)*(10*cos(12*t)) -sin(2*t)*(26*sin(12*t))
sin(2*t)*(10* cos(12*t)) +cos(2*t)*(26*sin(12*t))
``````

over range `0` to `PI` with stepping `PI/24` and you get. Where 12 is the number of lobes.

Image 2: Screenshot of jooGraphFunction GUI and a few alternate versions with different number of lobes.

Image 2: And drawing with same number of lobes as yours (36) made with same technique.

You can also dissect the script for a starting point for your own learning.

• I don't know the options for jooGraphFunction but opensource alternative is LaTeX+TikZ. You can write a script, export it as a pdf and import it as a vector graphics in the Illustrator. Matlab/Octave is also able to export nice vector graphics. – Crowley Feb 22 '17 at 12:46
• This is awesome, exactly what I was looking for. I will need to run other parametric equations as well and this makes it so easy. Thank you for the time spent on this. – sabithpocker Feb 22 '17 at 13:04
• @Crowley yes well its pretty easy to do in numerous different tools. The script is licensed under MIT, nothing stops anybody from emitting postscript, or svg from it. But this script is modified to suit illustrating because it does try to fit the Béziers on it. And not make it out of segments like most graphing tools do. – joojaa Feb 22 '17 at 16:48
• @joojaa both TikZ and Matlab results will be dependent on sampling of the curve and both can render vector graphics. If it is shaded, Matlab exports bitmaps only, though... I wish I could upvote your answer for both the solution and the function definition. – Crowley Feb 22 '17 at 16:55
• @Crowley Matlab can export vectors. But yes i know how tikz and matlab work. – joojaa Feb 22 '17 at 17:13

I know the OP asks for Illustrator, but if you don't mind spending zero €/\$ on a piece of software, this is a native feature in Inkscape.

• That is interesting. I've never tried inkscape. I'll try this. – sabithpocker Feb 23 '17 at 10:27

True spirographs are not easily achieved, for they are continuous lines, as opposed to your example. You could try Illustrator scripting to achieve that, or look at Luciano's answer.

For a very similar effect, you'd take an ellipse or-ellipse-like shape and rotate and copy that a number of times. The rotation angle should be a number of degrees that 360° is divisible by.

A typical way to make your example would be:

• Draw your ellipse using the `Ellipse` tool (shortcut L);
• Make sure the ellipse has a stroke and no fill;
• With the ellipse still selected, switch to the `Rotate` tool (R);
• With your Left Alt pressed, click the ellipse's centre--a registration mark should already be visible there. Your cursor should be a precision cross with three dots on the side;
• In the dialogue that pops up, choose an angle (θ) that, when multiplied with a whole number (n), yields 360°;
• Click Copy;
• Choose Object > Transform > Transform Again or press Cmd / Ctrl+D for a number of times (n-2) until your figure is complete.

Alternatively, you could use a dynamic Transform effect for this and keep both the shape and the number of copies editable:

• Draw a non-fill ellipse as above;
• With the shape selected, choose Effect > Distort & Transform > Transform...;
• Choose your angle θ under the 'Rotate' heading. Don't touch the 'Scale' or 'Move' settings (yet);
• Enter a number of copies n-1 in the bottom of the dialogue;
• Press OK.

This effect is dynamically applied to the base shape, you can edit the shape and the effect will follow suit. You can also double click on the effect in the `Appearance` palette to edit it. This way, you can create multiple different shapes in a jiffy.

You can experiment with all the other settings to make the most amazing art this way. Checking the Preview box allows you to peek at what you are achieving.

For added fun & giggles, you could do this trick with a filled shape that has any non-'normal' blend mode and/or an opacity lower than 100%.

• Awesome, Let me give it a try. But looks like this is an approximation to a spirograph which is a continuous single line and not repeated ellipses. – sabithpocker Feb 22 '17 at 9:47
• you can still do continuous line without scripting, check my answer. Although it would probably be far easier with scripting. – Luciano Feb 22 '17 at 10:07
• @Lucian The output you showed is just WOW. I am a Javascript Programmer myself and has done a spirograph code, but never tried AI Scripting. I'll give it a try too. – sabithpocker Feb 22 '17 at 10:17

There's this excellent video tutorial that is far too long to explain here, but there are different ways to create continous-line spirographs in Illustrator.

TL/DR; create ellipses, rotate-duplicate them and clean up the extra points.

Make sure you have smart guides enabled (View > Smart Guides)

1. create an ellipse that is taller than wider (stroke only, no fill)
2. with the Rotate r tool, option+click on the top anchor and type an angle that when multiplied with a whole number (n), yields 360°. Click Copy
3. Now do the option+click on the newly created ellipse, on the opposite point.
4. keep duplicating the shape until you have (n) shapes.
5. Use the a tool to select all points in the center of your spirograph, and delete them.
6. Join the paths (cmd+j)
7. Shift+ drag around the last created point in the last duplicated shape to deselect it
8. Convert the selected anchor points to smooth clicking on the button in the Anchor Point menu
9. select the remaining un-smooth points and cmd+shift+option+j to join the points, choose "Smooth"
• That reads like a very nice method. Will have to try myself! – Vincent Feb 22 '17 at 10:34

Note that Im using Illustrator CS 6 Differences in shortcut or appearance of the highlighted tool in other versions may occur :-)

First make a circle (Press L or use eclipse tool)

Then use the circle to make a petal shape (Press E or use Free transform tool) drag only the right or left side while pressing alt to have an equal re-shaping.

Then make the lower tip of the petal (Press Shift+C or Use Convert Anchorpoint Tool)

Select the two points left and right then adjust it upward to have the desiged shape (Press A or Direct Selection Tool and the Adjust by up Key)

Change the Anchor Location (Press R + Alt + Location-see reference for my location)

Rotate the Petal by 5 Repeat based on your desired artwork (360/5=72) (Press R or Use Rotate Tool + type the angle then Press COPY) Repeat the Copying (Do it 3 Times) by Pressing Ctrl D while the copy is highlighted.

Adjust Your First Petal shape if you need the perfect star inside.

In order the lines to be visible select all the paths/petal layer and make the opacity to be multiply.

Draw 1 ellipse....

Choose `Effect > Distort & Transform > Transform...`