Skip to content

string-art

3 motifs. Import them from geomotif.motifs, or build one by name with registry.create("string-art.corner").

string-art.corner

string-art.corner

Two arms, laced so the far end of one meets the near end of the other.

from geomotif import save_svg
from geomotif.motifs import StringArtCorner

motif = StringArtCorner()
save_svg(motif.build(), "string-art.corner.svg", width=320, height=320)
geomotif render string-art.corner --out string-art.corner.svg
{
  "geomotif": "1.3.1",
  "motif": "string-art.corner",
  "params": {
    "merge": false,
    "show_nodes": false,
    "count": 20,
    "corner": [
      0.0,
      0.0
    ],
    "arm_a": [
      200.0,
      0.0
    ],
    "arm_b": [
      0.0,
      200.0
    ]
  }
}
Parameters
Name Type Default
count int 20
corner Point (0.0, 0.0)
arm_a Point (200.0, 0.0)
arm_b Point (0.0, 200.0)
merge bool False
show_nodes bool False

string-art.envelope

string-art.envelope

The general engine: nail i on one curve, to nail rule(i) on another.

from geomotif import save_svg
from geomotif.motifs import StringArtEnvelope

motif = StringArtEnvelope()
save_svg(motif.build(), "string-art.envelope.svg", width=320, height=320)
geomotif render string-art.envelope --out string-art.envelope.svg

This motif has no spec:

cannot write string-art.envelope.rule to a spec: a function is not data. A motif parameterized by a Python function is defined by code, and can only be rebuilt in Python -- pass the motif itself rather than a spec
Parameters
Name Type Default
count int 144
rule Callable[[int], int] a function
curve Callable[[float], Point] a function
partner Callable[[float], Point] | None a function
merge bool False
show_nodes bool False

string-art.polygon

string-art.polygon

A strung corner at every corner of a regular polygon.

from geomotif import save_svg
from geomotif.motifs import StringArtPolygon

motif = StringArtPolygon()
save_svg(motif.build(), "string-art.polygon.svg", width=320, height=320)
geomotif render string-art.polygon --out string-art.polygon.svg
{
  "geomotif": "1.3.1",
  "motif": "string-art.polygon",
  "params": {
    "merge": false,
    "show_nodes": false,
    "sides": 5,
    "count": 16,
    "radius": 130.0,
    "rotation": 1.5707963267948966,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
sides int 5
count int 16
radius float 130.0
rotation float 1.5707963267948966
center Point (0.0, 0.0)
merge bool False
show_nodes bool False