Turtle Nodes

john's Avatar


28 Apr, 2021 10:05 AM

Attached is a demo with THREE new animation nodes:

  • turtle_morph: morph one polyline path into another
  • turtle_drive: move a pointer around a polyline path
  • unwind: unwind a polyline path into a line or segmented curve

At the heart of these nodes are two more sub-nodes:

  • turtle_table: turn a polyline path into a table of vectors (angles and distances)
  • draw_turtle: turn a turtle table back into a polyline path

A "turtle table" is a list of list of relative direction changes and distances that could be used to follow a path by turning and then moving at each step. Positive angles mean "turn right from your current heading"; negative angles mean "turn left from your current heading". In this way a turtle table functions like a Logo program used to control an educational turtle robot:


One of my attachments is a screenshot of a turtle table showing how to draw a turtle pointer shape in 29 steps.

Why would you want to turn a path into a turtle table and then back into a path? The surprising answer: in order to create butter-smooth languid animations!

The trick is to change the turtle table before redrawing it. Because the turtle table turns a standard Nodebox path (composed of points) into a list of vectors (angles and distances), it becomes possible to smoothly morph or unwind that path by gradually changing the values of those angles and distances. This is a simple but powerful idea.

Turtle_morph turns two paths into turtle tables and then gradually interpolates the angles and distances from one to the other. Its T port takes a percentage value from 0 to 100; hook a frame node to that port and hit play to morph one path into another. This works best if both paths have the same number of segments, but interesting things can happen if you break this rule.

Unwind is similar except that it only takes one path and turns that into a line or segmented curve. The "first angle" controls the angle of that line (or slope of the curve). If you set "other angles" to 0, the result with be a straight line; if you set it to a non-zero value each line segment will eventually have the same value resulting in a segmented curve (the bigger the angle the greater the curvature). "Segment size" controls the final length of the unwound path.

Turtle drive moves a pointer around a path moving like a turtle robot. The pointer doesn't just follow the path in a continuous motion. Instead it first turns to change its heading, then moves to the next inflection point, then turns, then moves. If you don't provide a pointer shape, it will default to using a tiny turtle as a pointer.

All these nodes work on polyline paths - no curves allowed. So if you have a curved path you should resample it first. If you want to simulate smooth looking curves, make sure you have a sufficient number of points in your resampled path. If you are turning a line into another path, you will probably want to increase the points setting on the line node to more than 2.

The attached demo (see screenshot and animated GIF) shows these nodes in action:

  • At top left a turtle pointer follows the path of a larger turtle which is simultaneously unwinding into a smile
  • At top right a circle (actually a 29-sided polygon) gradually morphs into a turtle
  • At bottom left a polygon unwinds into a slanted line
  • At bottom right an arrow pointer moves around a triangle (passing the frame though a mod 100 node produces continuous motion)

As I said, this is a surprisingly powerful technique. I've been using it for months now to produce animations on my Instagram account. Here are just a few recent examples:

I am still discovering beautiful effects by feeding different paths into these nodes and turning the knobs to different settings. Give these nodes a try and please consider sharing whatever you come up with.



Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • turtle_demo.gif 152 KB
  • turtle_nodes_screenshot.png 445 KB
  • turtle_table.png 114 KB
  • turtle_demo.zip 22.9 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

23 Jun, 2021 01:36 AM
20 Jun, 2021 07:19 AM
13 Jun, 2021 11:19 PM
06 Jun, 2021 09:27 AM
05 Jun, 2021 10:17 AM


05 Jun, 2021 07:45 AM
23 May, 2021 10:05 PM
23 May, 2021 10:02 PM
17 May, 2021 12:04 AM
16 May, 2021 01:00 PM
14 May, 2021 03:16 PM