Turtle Path

This page documents the development version of Graphite at dev.graphite.art, which may differ from the current release.

Draws paths by following a string of turtle commands, like the ones an L-System grows. F and G move forward a step while drawing, f and g move without drawing, + and - turn left and right, | turns around, and [ and ] begin and end a branch.

A number in parentheses gives one command its own amount, like F(25) or +(30), and a second number on F or G is the width it draws to, like F(25, 3).

H and h go half a step, drawing or not. " and _ multiply and divide the step from then on, as ; and @ do the angle and ! and ? the width. ~ turns a random amount, and T bends the heading toward the ground. ' and # count up two numbers, U and V, for coloring or anything else downstream.

{ begins a filled shape, . adds an anchor where the turtle stands, and } closes it. Outside a shape, . places a point on no path instead, for Vector to Points and Transform to copy shapes onto. Its kind is 1, or a number like .(2) gives another, so different shapes can go to different points.

Each point records its branch depth, distance traveled, heading, width, step length, UV, and kind as attributes. Drawn points have a kind of 0.

Interface

Inputs

ParameterDetailsPossible Types
Commands

The commands for the turtle to follow, starting at the origin and facing up. Symbols without a meaning are skipped.

Primary Input

String[]
String
Step

How far each step forward moves, unless a command gives its own distance like F(25).

Default: 10 px

Number[]
Number
Step Scale

The factor that " multiplies the step by and _ divides it by, unless a command gives its own like "(0.8).

Default: 0.5x

Number[]
Number
Step Jitter

How much longer or shorter each step may randomly be, as a fraction of its length.

Default: 0

Number[]
Number
Angle

How far + and - turn, unless a command gives its own angle like +(30).

Default: 90°

Number[]
Number
Angle Scale

The factor that ; multiplies the angle by and @ divides it by, unless a command gives its own like ;(0.8).

Default: 0.5x

Number[]
Number
Angle Jitter

How much wider or narrower each turn by + and - may randomly be, as a fraction of its angle.

Default: 0

Number[]
Number
Width

The width the turtle starts drawing with.

Default: 1 px

Number[]
Number
Width Scale

The factor that ! multiplies the width by and ? divides it by, unless a command gives its own like !(0.8).

Default: 0.5x

Number[]
Number
Width Jitter

How much thicker or thinner each line's width may randomly be, as a fraction of it.

Default: 0

Number[]
Number
Tropism

How far T bends a sideways heading toward the ground like branches sagging under gravity, and less the nearer it is to vertical, unless a command gives its own amount like T(5). A negative amount bends toward the sky instead.

Default: 10°

Number[]
Number
UV Increment

How much ' and # count up U and V, unless a command gives its own amount like '(2).

Default: 1., 1

Vec2[]
Vec2
Seed

Seed to determine unique variations on the random turns of ~ and the step, angle, and width jitters.

Default: 0

Integer[]
Integer

Outputs

ProductDetailsPossible Types
Result

The value produced by the node operation.

Primary Output

Vector
Vector[]