Unlock custom brushes, natural fill effects and intuitive hatching in p5.js
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Hatch Array Regression</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.min.js"></script>
<script src="../../dist/p5.brush.js"></script>
<script src="./p5_first_frame_profiler.js"></script>
<style>
:root {
--paper: #f3eee2;
--ink: #22313f;
--muted: #52616e;
--line: #d4c8b8;
--panel: rgba(255, 252, 245, 0.86);
--accent: #153e5c;
}
* { box-sizing: border-box; }
body {
margin: 0;
color: var(--ink);
background:
radial-gradient(circle at top left, rgba(21, 62, 92, 0.08), transparent 24%),
linear-gradient(180deg, #f7f2e7 0%, #ece3d3 100%);
font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
main {
width: min(920px, calc(100vw - 24px));
margin: 0 auto;
padding: 18px 0 24px;
display: grid;
justify-items: center;
}
main > * { width: 100%; }
.nav {
margin-bottom: 14px;
font: 11px/1.2 Menlo, Monaco, "Courier New", monospace;
display: flex;
gap: 12px;
}
.nav a {
color: var(--accent);
text-decoration: none;
}
.nav a:hover { text-decoration: underline; }
.nav .sep { color: #8a9aa8; }
h1 {
margin: 0 0 8px;
font-size: clamp(24px, 3.6vw, 34px);
letter-spacing: -0.04em;
}
p {
margin: 0 0 8px;
max-width: 760px;
color: var(--muted);
line-height: 1.45;
font-size: 13px;
}
.panel {
border: 1px solid var(--line);
border-radius: 8px;
background: var(--panel);
}
.note {
margin-top: 18px;
padding: 12px 14px;
font: 11px/1.4 Menlo, Monaco, "Courier New", monospace;
color: var(--accent);
}
.toolbar {
margin-top: 18px;
padding: 12px 14px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
font: 11px/1.4 Menlo, Monaco, "Courier New", monospace;
}
.mode-group {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.mode-group strong {
color: var(--accent);
font-weight: 600;
}
.mode-group button {
border: 1px solid var(--line);
background: #fbf8f0;
color: var(--accent);
font: inherit;
padding: 6px 10px;
border-radius: 6px;
cursor: pointer;
}
.mode-group button.active {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
#canvas-host {
margin-top: 16px;
padding: 10px;
display: grid;
place-items: center;
width: 100%;
overflow: hidden;
}
canvas {
display: block;
border-radius: 6px;
width: min(720px, calc(100vw - 68px)) !important;
height: auto !important;
max-width: 100%;
}
</style>
</head>
<body>
<main>
<div class="nav">
<a href="../index.html">All tests</a>
<span class="sep">·</span>
<a href="./hatch_test.html">Full hatch coverage</a>
</div>
<h1>Hatch Array Regression</h1>
<p>
Minimal regression page for <strong>brush.hatchArray([outer, inner])</strong> using two concentric circles.
</p>
<p>
Expected result: only the annulus is rendered. The center disk must stay empty, with no hatch or mass gestures crossing the hole.
</p>
<div class="note panel">Regression target: nested polygon arrays must use even-odd pairing across all contours.</div>
<div class="toolbar panel">
<div class="mode-group">
<span>Render mode</span>
<strong id="mode-label">Hatch</strong>
<button id="mode-hatch" type="button" class="active">Hatch</button>
<button id="mode-mass" type="button">Mass</button>
</div>
</div>
<div id="canvas-host" class="panel"></div>
</main>
<script src="./hatch_array_regression.js"></script>
<script src="../test-nav.js"></script>
</body>
</html>