Public
Edited
Oct 22, 2023
12 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
blurp({ invalidation, href: "https://art.saneef.com/fizzled-grid" })
Insert cell
Insert cell
Insert cell
Insert cell
params = {
if (randomize === 0) {
return {
divs: 20,
steps: 10,
drawBorder: false
};
}

return {
divs: random.rangeFloor(...divsRange),
steps: random.rangeFloor(...divsRange),
drawBorder: random.boolean()
};
}
Insert cell
Insert cell
Insert cell
drawBorder = (data) => {
if (showBounds) {
return svg`<rect
x=${marginX} y=${marginY}
width=${size} height=${size}
fill="none"
stroke=${palette.fg}
stroke-width=${strokeWidth}></rect>`;
}

return svg`<line x1=${marginX} y1=${marginY}
x2=${marginX + size} y2=${marginY}
stroke-width=${strokeWidth}
stroke=${palette.fg}
stroke-linecap="round"
></line>
<line x1=${marginX} y1=${marginY + size}
x2=${marginX + size} y2=${marginY + size}
stroke-width=${strokeWidth}
stroke=${palette.fg}
stroke-linecap="round"
></line>`;
}
Insert cell
drawLines = (data) =>
data.map((line) => {
const lineXs = line.map(uv2xy);
const rowHeight = size / (steps - 1);
const lineXY = lineXs.map((x, i) => [marginX + x, marginY + i * rowHeight]);

const d = d3.line().curve(d3[curve])(lineXY);
return svg`<path d="${d}"
stroke-width=${strokeWidth}
stroke=${palette.fg}
fill="none"
></path>`;
})
Insert cell
Insert cell
seed = seedBase + randomize * 27
Insert cell
seedBase = random.value()
Insert cell
uv2xy = (u) => math.lerp(0, size, u)
Insert cell
marginY = (height - size) / 2
Insert cell
marginX = (width - size) / 2
Insert cell
size = maxSize - 2 * maxMargin
Insert cell
maxMargin = marginUV * (maxSize / 5) + strokeWidth / 2
Insert cell
maxSize = Math.min(width, height)
Insert cell
height = width
Insert cell
palette = ({
bg: `hsl(0,0%,95%)`,
fg: `hsl(0,0%,5%)`,
debug: `hsl(300, 100%, 50%)`
})
Insert cell
html`
<style>
.artwork {
display: block;
max-width: max(50vw, 640px);
height: auto;
}
</style>`
Insert cell
svg = htl.svg
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more