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>p5.brush - Instance Mode Test</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>
* {
box-sizing: border-box;
}
body {
margin: 0;
background:
radial-gradient(circle at top left, rgba(20, 48, 73, 0.08), transparent 24%),
linear-gradient(180deg, #f7f2e7 0%, #ece3d3 100%);
color: #22313f;
font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
main {
width: min(1240px, 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: #153e5c;
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 {
max-width: 860px;
margin: 0 0 8px;
color: #52616e;
line-height: 1.45;
font-size: 13px;
}
.legend {
font: 11px/1.4 Menlo, Monaco, "Courier New", monospace;
color: #405160;
}
#instance-mode-app {
width: 100%;
margin-top: 18px;
display: grid;
justify-content: center;
overflow: hidden;
}
canvas {
display: block;
max-width: 100%;
height: auto !important;
}
</style>
</head>
<body>
<main>
<div class="nav">
<a href="../index.html">All tests</a>
<span class="sep">·</span>
<span style="color:#8a9aa8;">p5 specific</span>
</div>
<h1>Instance Mode Test</h1>
<p>
This page is rendered entirely by a <b>new p5((p) => {})</b> sketch and checks that
<b>brush.instance(p)</b> and <b>brush.load()</b> behave correctly in instance mode.
</p>
<p class="legend">
The three rows cover direct drawing on the instance canvas, drawing into an instance-owned
<b>p5.Graphics</b> target, and drawing into an instance-owned main <b>p5.Framebuffer</b>.
All three should show the same scene with the same textures.
</p>
<div id="instance-mode-app"></div>
<script src="./instance_mode_test.js"></script>
</main>
<script src="../test-nav.js"></script>
</body>
</html>