primordial-soup/viewer/pond.js

41 lines
3.2 KiB
JavaScript

import { CELLS } from "../engine/catalog.js";
export function pondArt() {
const shore =
"M239 38 Q217 37 211 66 L211 347 Q211 365 193 365 L77 365 Q39 367 38 396 L38 443 Q35 475 76 479 L193 479 Q211 479 211 496 L211 563 Q211 604 250 605 L812 605 Q864 602 864 563 L864 184 Q864 148 821 147 L708 147 Q691 146 691 129 L691 70 Q691 37 649 37 Z";
let s = `<defs><linearGradient id="soup-water" x1="0" x2=".8" y1="0" y2="1"><stop stop-color="#bee8cc"/><stop offset=".6" stop-color="#9fd7c0"/><stop offset="1" stop-color="#81baa4"/></linearGradient><radialGradient id="soup-light"><stop stop-color="#f4ffe9" stop-opacity=".65"/><stop offset=".45" stop-color="#f4ffe9" stop-opacity=".3"/><stop offset="1" stop-color="#f4ffe9" stop-opacity="0"/></radialGradient><pattern id="soup-speckle" width="31" height="29" patternUnits="userSpaceOnUse"><circle cx="4" cy="8" r=".65" fill="#3c8875" opacity=".17"/><circle cx="23" cy="22" r=".7" fill="#fff" opacity=".3"/></pattern><clipPath id="soup-pond-clip"><path d="${shore}"/></clipPath></defs><path d="${shore}" fill="#d8e5b9" stroke="#bed0aa" stroke-width="20" stroke-linejoin="round"/><path d="${shore}" fill="url(#soup-water)" stroke="#739d7c" stroke-width="2"/><g clip-path="url(#soup-pond-clip)"><rect width="900" height="650" fill="url(#soup-speckle)"/>`;
for (let n = 0; n < 14; n++) {
const x = 100 + ((n * 193) % 730),
y = 90 + ((n * 127) % 470);
s += `<g transform="translate(${x} ${y})"><g class="pond-flow" style="--delay:-${n * 1.7}s;--flow-duration:${18 + (n % 4) * 2}s"><ellipse class="pond-light" rx="${70 + (n % 3) * 12}" ry="32" fill="url(#soup-light)"/></g></g>`;
}
s +=
'<g class="grid-lines" fill="none" stroke="#e5f5da" stroke-width="1.3" stroke-opacity=".6">';
for (const cell of CELLS) {
const x = 60 + (cell % 5) * 156,
y = 55 + Math.floor(cell / 5) * 105;
s += `<path d="M${x} ${y}q80 4 156 0v105q-75-4-156 0Z"/>`;
}
s += "</g>";
for (let n = 0; n < 38; n++)
s += `<circle class="pond-bubble" cx="${65 + ((n * 173) % 780)}" cy="${53 + ((n * 83) % 535)}" r="${2 + (n % 4)}" fill="none" stroke="#ecffe5" stroke-width="1.2" style="--delay:-${n * 1.3}s;--flow-duration:${16 + (n % 5) * 2}s"/>`;
s +=
'</g><path d="M381 273Q396 263 413 271Q441 260 461 271Q500 266 515 284Q530 301 520 328Q525 359 492 363Q463 374 442 365Q412 373 389 356Q368 340 376 319Q366 291 381 273Z" fill="#dce7c4" stroke="#99b69a" stroke-width="2"/>';
for (const [x, y, r] of [
[217, 59, 18],
[694, 135, 14],
[57, 475, 17],
[211, 558, 13],
[840, 594, 19],
[693, 50, 12],
])
s += `<ellipse cx="${x}" cy="${y}" rx="${r}" ry="${r * 0.55}" fill="#b7c9a5" stroke="#93aa87"/><path d="M${x - r * 0.5} ${y - 2}q${r * 0.5}-6 ${r} 0" fill="none" stroke="#dce8c9" stroke-width="2"/>`;
for (const [x, y, r] of [
[204, 347, 15],
[219, 35, 150],
[865, 212, -50],
[786, 608, 60],
[75, 364, -15],
])
s += `<g transform="translate(${x} ${y}) rotate(${r})"><path d="M0 0Q-14-29-30-31Q-28-7 0 0M0 0Q-22-4-34 10Q-9 17 0 0M0 0Q-3-33 9-45Q21-18 0 0M0 0Q19-24 35-21Q29 1 0 0" fill="#89ac74" stroke="#658d69" stroke-width="1.5"/><path d="M0 0 9-33M0 0-23-24M0 0 24-16" stroke="#c9dca6" fill="none"/></g>`;
return s;
}