diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 47ece85..d741102 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -2,7 +2,7 @@ name: Build
on:
push:
- branches: [main, Dev]
+ branches: [main, dev]
pull_request:
workflow_dispatch:
diff --git a/.gitignore b/.gitignore
index 4e2e7b0..202cbdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-# Exported plots
-GenerativeLineArt/exports/*.svg
+# Exported plots (SVG, G-code, HPGL, batch folders)
+GenerativeLineArt/exports/*
+!GenerativeLineArt/exports/.gitkeep
# Downloads (web addresses, streets, terrain, weather) cached by the sketch
GenerativeLineArt/cache/
diff --git a/GenerativeLineArt/Cli.pde b/GenerativeLineArt/Cli.pde
index e53567a..4163ba2 100644
--- a/GenerativeLineArt/Cli.pde
+++ b/GenerativeLineArt/Cli.pde
@@ -241,7 +241,7 @@ JSONArray paramsJSON(ArrayList ps) {
// its layer settings, then the page settings. Choices take the option name
// (or its number), toggles on/off/true/false/1/0.
void cliSet(String spec) {
- int eq = spec.indexOf('=');
+ int eq = spec.lastIndexOf('='); // names may contain '=' ("Spacing (0=off)"), values don't
if (eq <= 0) cliError("--set needs =, e.g. --set \"Lines=80\"");
String name = spec.substring(0, eq).trim(), v = spec.substring(eq + 1).trim();
Layer L = layers[curLayer];
diff --git a/GenerativeLineArt/GenerativeLineArt.pde b/GenerativeLineArt/GenerativeLineArt.pde
index 6f6d5c3..ffef0ee 100644
--- a/GenerativeLineArt/GenerativeLineArt.pde
+++ b/GenerativeLineArt/GenerativeLineArt.pde
@@ -203,12 +203,10 @@ void setup() {
void draw() {
background(C_CANVAS);
- if (pendingExport != null) { File f = pendingExport; pendingExport = null; writeExport(f); }
if (pendingPresetSave != null) { File f = pendingPresetSave; pendingPresetSave = null; savePreset(f); }
if (pendingPresetLoad != null) { File f = pendingPresetLoad; pendingPresetLoad = null; loadPreset(f); }
if (pendingPhoto != null) { File f = pendingPhoto; pendingPhoto = null; loadPhoto(f); }
if (pendingMask != null) { File f = pendingMask; pendingMask = null; loadMaskImage(f); }
- if (pendingShare != null) { File f = pendingShare; pendingShare = null; writeShareImage(f); }
runMainQueue();
pollWatchFolder();
@@ -216,6 +214,10 @@ void draw() {
if (pendingBatch) { pendingBatch = false; batchExport(); }
if (exploreOn && layers[exploreLayer].dirty) newExploreBatch(); // the layer changed: start over
regenerate();
+ // exports run after the page and the layers are up to date, so a change made
+ // just before pressing S (or a preset loaded in the same frame) is included
+ if (pendingExport != null) { File f = pendingExport; pendingExport = null; writeExport(f); }
+ if (pendingShare != null) { File f = pendingShare; pendingShare = null; writeShareImage(f); }
if (pendingAutoExport != null) { File f = pendingAutoExport; pendingAutoExport = null; writeExport(f); }
if (cliStep()) return;
buildPanel();
@@ -402,7 +404,7 @@ ArrayList makeParams(Layer L, int mode) {
l.add(P(L, "b", -3, 3, 1.6, false));
l.add(P(L, "c", -3, 3, 1.0, false));
l.add(P(L, "d", -3, 3, 0.7, false));
- l.add(P(L, "Iterations", 200, 100000, 2500, true));
+ l.add(P(L, "Iterations", 200, 100000, 6000, true));
l.add(P(L, "Strands", 1, 40, 1, true));
break;
case 9: // Superformula
@@ -748,6 +750,12 @@ void keyPressed() {
if (focusText != null) { typeText(focusText); return; }
if (exploreKey()) return;
if (simKey()) return;
+ if (key == ESC) { // Esc closes the dropdown or the zoom, never the app
+ key = 0;
+ if (ddOpen) ddOpen = false;
+ else if (viewZoom > 1) resetView();
+ return;
+ }
Layer L = layers[curLayer];
boolean ctrl = keyEvent != null && (keyEvent.isControlDown() || keyEvent.isMetaDown());
if (ctrl) {
@@ -2359,18 +2367,25 @@ void genAttractor(ArrayList> out) {
float sc = min(w / sw, h / sh) * 0.98;
float cx = (xmin + xmax) / 2 - (x0 + x1) / 2 * sc, cy = (ymin + ymax) / 2 - (y0 + y1) / 2 * sc;
- int per = max(2, iters / strands);
+ // Successive iterates of these maps jump all over the attractor, so joining
+ // them with lines only gives a tangle. Each iterate is drawn as a tiny dash
+ // (a pen dot) instead; the dots build up the attractor's shape. 'Strands' =
+ // number of orbits started from different random points.
+ int per = max(1, iters / strands);
+ float dl = 0.35; // dash length (mm): a dot at plotter pen widths
for (int sIdx = 0; sIdx < strands; sIdx++) {
x = random(-1, 1); y = random(-1, 1);
- ArrayList pts = new ArrayList(per);
for (int i = 0; i < per + 50; i++) {
float nx, ny;
if (type == 0) { nx = sin(a * y) + c * cos(a * x); ny = sin(b * x) + d * cos(b * y); }
else { nx = sin(a * y) - cos(b * x); ny = sin(c * x) - cos(d * y); }
x = nx; y = ny;
- if (i >= 50) pts.add(new PVector(cx + x * sc, cy + y * sc));
+ if (i < 50) continue; // let the orbit settle onto the attractor
+ float px = cx + x * sc, py = cy + y * sc;
+ ArrayList dot = new ArrayList(2);
+ dot.add(new PVector(px - dl / 2, py)); dot.add(new PVector(px + dl / 2, py));
+ emit(out, dot);
}
- emit(out, pts);
}
}
diff --git a/GenerativeLineArt/NumberEntry.pde b/GenerativeLineArt/NumberEntry.pde
index 09e9d5c..62a3a21 100644
--- a/GenerativeLineArt/NumberEntry.pde
+++ b/GenerativeLineArt/NumberEntry.pde
@@ -6,10 +6,12 @@
Param numParam = null;
TextVal tvNum = new TextVal("", 24);
float sliderPressVal = 0; // value before the press (a double-click restores it)
+boolean numFresh = false; // the field still shows the old value: typing replaces it
void startNumEdit(Param p) {
numParam = p;
tvNum.s = fmtParam(p);
+ numFresh = true;
focusText = tvNum;
}
@@ -55,9 +57,17 @@ boolean numKey() {
if (keyEvent != null && keyEvent.isShiftDown()) step *= 10;
p.set(p.val + (keyCode == UP ? step : -step));
tvNum.s = fmtParam(p);
+ numFresh = true;
return true;
}
if (key >= 32 && key != DELETE && "0123456789.,-+*/x eE".indexOf(key) < 0) return true; // ignore letters
+ // the first key replaces the old value (so "1500", "*2" or "+10" work as typed)
+ boolean paste = keyEvent != null && (keyEvent.isControlDown() || keyEvent.isMetaDown()) && keyCode == 'V';
+ if (numFresh && (paste || key == BACKSPACE || (key >= 32 && key != DELETE && key != CODED))) {
+ tvNum.s = "";
+ numFresh = false;
+ return key == BACKSPACE;
+ }
return false;
}
@@ -78,6 +88,7 @@ void drawNumField(SliderW w) {
float fw = max(56, textWidth(t) + 16);
stroke(C_ACCENT); strokeWeight(1); fill(C_FIELD);
rect(w.x + w.w - fw, w.y - 3, fw, 19, 3);
+ if (numFresh) { noStroke(); fill(C_ACCENT, 90); rect(w.x + w.w - 7 - textWidth(t) - 2, w.y - 1, textWidth(t) + 4, 15, 2); } // selected
noStroke(); fill(C_TEXT); textAlign(RIGHT, TOP);
text(t, w.x + w.w - 7, w.y);
if ((millis() / 500) % 2 == 0) { stroke(C_ACCENT); line(w.x + w.w - 5, w.y - 1, w.x + w.w - 5, w.y + 14); }
diff --git a/GenerativeLineArt/ShareImage.pde b/GenerativeLineArt/ShareImage.pde
index e98c844..99a2ab3 100644
--- a/GenerativeLineArt/ShareImage.pde
+++ b/GenerativeLineArt/ShareImage.pde
@@ -59,14 +59,19 @@ PGraphics shareImage(int longSide) {
float ts = longSide * 0.026, ty = pad + ph + foot * 0.42;
g.textFont(uiFont);
g.textAlign(LEFT, CENTER);
- g.fill(0xFF2A2A2A); g.textSize(ts);
- g.text(pats.isEmpty() ? "Empty design" : join(pats.toArray(new String[0]), " + "), pad, ty);
- g.fill(0xFF77736C); g.textSize(ts * 0.62);
+ // the caption shrinks to stay clear of the pen swatches on the right
+ float r = ts * 0.55, room = pw - pens * r * 2.8 - r;
+ String title = pats.isEmpty() ? "Empty design" : join(pats.toArray(new String[0]), " + ");
String info = PAPER_NAMES[pPaper.i()] + (pLandscape.on() ? " landscape" : "") + " · " + round(genW) + " × " + round(genH) + " mm · "
+ pens + (pens == 1 ? " pen" : " pens") + " · " + String.format(Locale.US, "%.1f m of line", len / 1000) + " · plot time " + fmtTime(secs).replace("~", "about ");
+ g.fill(0xFF2A2A2A); g.textSize(ts);
+ if (g.textWidth(title) > room) g.textSize(max(ts * 0.4, ts * room / g.textWidth(title)));
+ g.text(title, pad, ty);
+ g.fill(0xFF77736C); g.textSize(ts * 0.62);
+ if (g.textWidth(info) > room) g.textSize(max(ts * 0.3, ts * 0.62 * room / g.textWidth(info)));
g.text(info, pad, ty + ts * 1.15);
// pen swatches, right-aligned
- float r = ts * 0.55, x = pad + pw - r;
+ float x = pad + pw - r;
for (int i = NUM_LAYERS - 1; i >= 0; i--) {
Layer L = layers[i];
if (!L.pEnabled.on()) continue;
diff --git a/README.md b/README.md
index f27a727..89d1e4e 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ Generative line art with a live-adjustable GUI, built as a single [Processing](h
## Features
- **35 patterns** — flow field, wave lines, spirograph, noise rings, Lissajous, contour map, Truchet tiles, hatch shading, strange attractor, superformula, nested polygons, spiral, moire circles, circle packing, harmonograph, Hilbert curve, sunburst, maze, L-system, guilloche, Maurer rose, phyllotaxis, subdivision, warped grid, fractal tree, Voronoi, image, hex Truchet, Penrose, hex maze, route, data lines, SVG import, audio, text.
+ - **Strange attractor** — Clifford and De Jong attractors, each point of the orbit drawn as a pen dot (stipple), so the attractor's shape builds up from thousands of dots.
- **Maze** — recursive-backtracker maze drawn as walls or as its centre-line path (same seed on two layers = walls + solution-style path in a second pen). Wall segments are merged into long strokes to minimise pen lifts.
- **L-system** — Koch snowflake, dragon curve, Gosper curve, Sierpinski arrowhead and a branching plant, with angle tweak, jitter and smoothing.
- **Guilloche** — banknote-style rosettes: interleaved lines oscillating between two lobed envelopes.