Skip to content

Unlock custom brushes, natural fill effects and intuitive hatching in p5.js

Cleaning

acamposuribef0c71afa7c12
diff --git a/package.json b/package.json
index 29ef47c..053744d 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,10 @@
"test:watch": "vitest",
"build": "rollup --config -w"
},
+ "files": [
+ "dist",
+ "src"
+ ],
"sideEffects": false,
"type": "module",
"repository": {
diff --git a/test/index.html b/test/index.html
index 557ab48..b73dfbf 100644
--- a/test/index.html
+++ b/test/index.html
@@ -181,67 +181,67 @@
<p>Use these pages to visually inspect the p5 build. Each links to its standalone counterpart.</p>
</div>
<div class="grid">
- <a class="card" href="./visual_suite.html">
+ <a class="card" href="./p5/visual_suite.html">
<h3>Visual API Suite</h3>
<p>Wide coverage page that exercises most public APIs and logs error-message checks to the console.</p>
<span class="meta">Coverage</span>
- <span class="path">test/visual_suite.html</span>
+ <span class="path">test/p5/visual_suite.html</span>
</a>
- <a class="card" href="./hatch_test.html">
+ <a class="card" href="./p5/hatch_test.html">
<h3>Hatch Test</h3>
<p>Exercises hatch angles, spacing, rand/continuous/gradient options, cross-hatching, brush types, shapes, and multi-polygon arrays.</p>
<span class="meta">Coverage</span>
- <span class="path">test/hatch_test.html</span>
+ <span class="path">test/p5/hatch_test.html</span>
</a>
- <a class="card" href="./fill_circle_explorer.html">
+ <a class="card" href="./p5/fill_circle_explorer.html">
<h3>Fill Circle Explorer</h3>
<p>Seeded single-shape page for inspecting watercolor fill bleed, opacity, texture, border, and palette color on a centered circle.</p>
<span class="meta">Explorer</span>
- <span class="path">test/fill_circle_explorer.html</span>
+ <span class="path">test/p5/fill_circle_explorer.html</span>
</a>
- <a class="card" href="./wash_test.html">
+ <a class="card" href="./p5/wash_test.html">
<h3>Wash Test</h3>
<p>Direct WEBGL wash page that draws five random rect and circle polygons with palette colors at full opacity.</p>
<span class="meta">Coverage</span>
- <span class="path">test/wash_test.html</span>
+ <span class="path">test/p5/wash_test.html</span>
</a>
- <a class="card" href="./field_explorer.html">
+ <a class="card" href="./p5/field_explorer.html">
<h3>Flow Field Explorer</h3>
<p>Interactive field inspector for comparing built-in fields with adjustable density and line length.</p>
<span class="meta">Explorer</span>
- <span class="path">test/field_explorer.html</span>
+ <span class="path">test/p5/field_explorer.html</span>
</a>
- <a class="card" href="./angle_mode_test.html">
+ <a class="card" href="./p5/angle_mode_test.html">
<h3>Angle Mode Test</h3>
<p>Compares degrees, radians, mixed mode changes, stored hatch angles, low-level Position movement, and custom fields.</p>
<span class="meta">Behavior</span>
- <span class="path">test/angle_mode_test.html</span>
+ <span class="path">test/p5/angle_mode_test.html</span>
</a>
- <a class="card" href="./transform_test.html">
+ <a class="card" href="./p5/transform_test.html">
<h3>Transform Alignment</h3>
<p>Checks that brush strokes and fills align with native p5 reference geometry under translate, rotate, and scale.</p>
<span class="meta">Geometry</span>
- <span class="path">test/transform_test.html</span>
+ <span class="path">test/p5/transform_test.html</span>
</a>
- <a class="card" href="./pushpop_test.html">
+ <a class="card" href="./p5/pushpop_test.html">
<h3>Push / Pop State</h3>
<p>Verifies that p5 push/pop restores stroke, brush, fill, and hatch state correctly.</p>
<span class="meta">State</span>
- <span class="path">test/pushpop_test.html</span>
+ <span class="path">test/p5/pushpop_test.html</span>
</a>
- <a class="card" href="./pastel_hatching_test.html">
+ <a class="card" href="./p5/pastel_hatching_test.html">
<h3>Pastel Hatching Test</h3>
<p>Minimal global-mode sketch with a custom crayon brush and a single centered rectangle for pastel hatching experiments.</p>
<span class="meta">Experiment</span>
- <span class="path">test/pastel_hatching_test.html</span>
+ <span class="path">test/p5/pastel_hatching_test.html</span>
</a>
</div>
</section>
diff --git a/test/angle_mode_test.html b/test/p5/angle_mode_test.html
similarity index 100%
rename from test/angle_mode_test.html
rename to test/p5/angle_mode_test.html
diff --git a/test/angle_mode_test.js b/test/p5/angle_mode_test.js
similarity index 100%
rename from test/angle_mode_test.js
rename to test/p5/angle_mode_test.js
diff --git a/test/field_explorer.html b/test/p5/field_explorer.html
similarity index 100%
rename from test/field_explorer.html
rename to test/p5/field_explorer.html
diff --git a/test/fill.test.js b/test/p5/fill.test.js
similarity index 97%
rename from test/fill.test.js
rename to test/p5/fill.test.js
index d3243d4..c85aad7 100644
--- a/test/fill.test.js
+++ b/test/p5/fill.test.js
@@ -67,7 +67,7 @@ vi.mock("../src/core/plot.js", () => ({
Plot: class Plot {},
}));
-import { createFill, fill } from "../src/fill/fill.js";
+import { createFill, fill } from "../../src/fill/fill.js";
describe("createFill()", () => {
beforeEach(() => {
diff --git a/test/fill_circle_explorer.html b/test/p5/fill_circle_explorer.html
similarity index 100%
rename from test/fill_circle_explorer.html
rename to test/p5/fill_circle_explorer.html
diff --git a/test/fill_circle_explorer.js b/test/p5/fill_circle_explorer.js
similarity index 100%
rename from test/fill_circle_explorer.js
rename to test/p5/fill_circle_explorer.js
diff --git a/test/hatch_test.html b/test/p5/hatch_test.html
similarity index 100%
rename from test/hatch_test.html
rename to test/p5/hatch_test.html
diff --git a/test/hatch_test.js b/test/p5/hatch_test.js
similarity index 100%
rename from test/hatch_test.js
rename to test/p5/hatch_test.js
diff --git a/test/p5_first_frame_profiler.js b/test/p5/p5_first_frame_profiler.js
similarity index 100%
rename from test/p5_first_frame_profiler.js
rename to test/p5/p5_first_frame_profiler.js
diff --git a/test/pastel_hatching_test.html b/test/p5/pastel_hatching_test.html
similarity index 100%
rename from test/pastel_hatching_test.html
rename to test/p5/pastel_hatching_test.html
diff --git a/test/pastel_hatching_test.js b/test/p5/pastel_hatching_test.js
similarity index 100%
rename from test/pastel_hatching_test.js
rename to test/p5/pastel_hatching_test.js
diff --git a/test/pushpop_test.html b/test/p5/pushpop_test.html
similarity index 100%
rename from test/pushpop_test.html
rename to test/p5/pushpop_test.html
diff --git a/test/sketch.js b/test/p5/sketch.js
similarity index 100%
rename from test/sketch.js
rename to test/p5/sketch.js
diff --git a/test/stroke_pressure.test.js b/test/p5/stroke_pressure.test.js
similarity index 97%
rename from test/stroke_pressure.test.js
rename to test/p5/stroke_pressure.test.js
index 15bd377..9861716 100644
--- a/test/stroke_pressure.test.js
+++ b/test/p5/stroke_pressure.test.js
@@ -59,7 +59,7 @@ vi.mock("../src/stroke/gl_draw.js", () => ({
snapshotMatrix: () => {},
}));
-import { add, box, normalizePressure } from "../src/stroke/stroke.js";
+import { add, box, normalizePressure } from "../../src/stroke/stroke.js";
describe("normalizePressure()", () => {
it("keeps function pressure in explicit custom mode", () => {
diff --git a/test/transform_test.html b/test/p5/transform_test.html
similarity index 100%
rename from test/transform_test.html
rename to test/p5/transform_test.html
diff --git a/test/unit.test.js b/test/p5/unit.test.js
similarity index 98%
rename from test/unit.test.js
rename to test/p5/unit.test.js
index 1dce827..bcb743d 100644
--- a/test/unit.test.js
+++ b/test/p5/unit.test.js
@@ -72,10 +72,10 @@ import {
seed,
weightedRand,
toDegreesSigned,
-} from "../src/core/utils.js";
-import { arc } from "../src/core/primitives.js";
-import { Position, addField, field as activateField, noField } from "../src/core/flowfield.js";
-import { hatch } from "../src/hatch/hatch.js";
+} from "../../src/core/utils.js";
+import { arc } from "../../src/core/primitives.js";
+import { Position, addField, field as activateField, noField } from "../../src/core/flowfield.js";
+import { hatch } from "../../src/hatch/hatch.js";
beforeEach(() => {
currentAngleMode.value = "radians";
diff --git a/test/visual_suite.html b/test/p5/visual_suite.html
similarity index 100%
rename from test/visual_suite.html
rename to test/p5/visual_suite.html
diff --git a/test/wash_test.html b/test/p5/wash_test.html
similarity index 100%
rename from test/wash_test.html
rename to test/p5/wash_test.html
diff --git a/test/wash_test.js b/test/p5/wash_test.js
similarity index 100%
rename from test/wash_test.js
rename to test/p5/wash_test.js