Skip to content
TypeScript
4.6 KB
Raw Blame
/**
 * Banner concept "ascii-hero" — matches the user's references: a classical hero
 * bust rendered as an ASCII/dot-pixel halftone, dissolving into a stormy spatial
 * field with lightning, duotone, bold "OLYMPUS RESEARCH PRESENTS — theseus"
 * lower-left (à la the HERMES 3B research card). Self-contained SVG.
 * Run: node scripts/design-hero.mjs  → assets/concepts/c7-ascii-hero-*.svg
 */
import { mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";

const OUT = "assets/concepts";
const W = 1200;
const H = 360;
const RAMP = " .:-=+*oct?%#@"; // dark → light

function rng(seed) {
  let a = seed >>> 0;
  return () => {
    a = (a + 0x6d2b79f5) | 0;
    let t = Math.imul(a ^ (a >>> 15), 1 | a);
    t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
  };
}

// bust silhouette test: head (circle) + shoulders (mound). figure faces forward.
const HEAD = { cx: 560, cy: 130, r: 66 };
function inFigure(x, y) {
  const dh = Math.hypot(x - HEAD.cx, y - HEAD.cy);
  if (dh <= HEAD.r) return true;
  // neck
  if (x > HEAD.cx - 26 && x < HEAD.cx + 26 && y > HEAD.cy && y < 210) return true;
  // shoulders mound: ellipse-ish cap
  const sx = (x - 560) / 150;
  const sy = (y - 330) / 150;
  if (y > 195 && sx * sx + sy * sy <= 1 && y < 332) return true;
  return false;
}

function build({ name, seed, bg, dim, mid, bright, bolt }) {
  const r = rng(seed);
  const step = 9;
  const cells = [];
  for (let y = 64; y < 336; y += step) {
    for (let x = 360; x < 900; x += step) {
      const inside = inFigure(x, y);
      // dissolve toward the right edge of the figure
      const edge = Math.max(0, (x - 660) / 220); // 0..1 past center-right
      const drop = inside ? edge * 0.9 : 0;
      // stray pixels trailing to the right (figure breaking into space)
      const stray = !inside && x > 640 && r() < 0.04 * Math.max(0, 1 - (x - 640) / 260);
      if ((!inside && !stray) || r() < drop) continue;
      // luminance: light from upper-left + dome falloff + noise
      const lx = (x - 470) / 320;
      const ly = (y - 80) / 300;
      let L = 1 - Math.min(1, Math.hypot(lx, ly) * 0.8) - ly * 0.15 + (r() - 0.5) * 0.35;
      if (stray) L *= 0.5;
      L = Math.max(0, Math.min(0.999, L));
      const ch = RAMP[Math.floor(L * RAMP.length)];
      if (ch === " ") continue;
      const col = L > 0.72 ? bright : L > 0.42 ? mid : dim;
      const op = stray ? 0.55 : 0.95;
      cells.push(
        `<text x="${x}" y="${y}" fill="${col}" opacity="${op}">${ch === "&" ? "&amp;" : ch === "<" ? "&lt;" : ch}</text>`,
      );
    }
  }

  // two lightning bolts (jagged polylines)
  const boltPath = (sx) => {
    let d = `M${sx},0`;
    let x = sx;
    let y = 0;
    while (y < 250) {
      y += 24 + r() * 26;
      x += (r() - 0.5) * 60;
      d += ` L${x.toFixed(0)},${y.toFixed(0)}`;
    }
    return d;
  };
  const bolts = `
    <path d="${boltPath(250)}" fill="none" stroke="${bolt}" stroke-width="2.2" opacity="0.55"/>
    <path d="${boltPath(840)}" fill="none" stroke="${bolt}" stroke-width="1.6" opacity="0.4"/>`;

  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" role="img" aria-label="theseus">
  <defs>
    <radialGradient id="g_${name}" cx="42%" cy="34%" r="80%">
      <stop offset="0" stop-color="${bg[0]}"/><stop offset="1" stop-color="${bg[1]}"/>
    </radialGradient>
  </defs>
  <rect width="${W}" height="${H}" rx="20" fill="url(#g_${name})"/>
  ${bolts}
  <g font-family="ui-monospace,'SF Mono',Menlo,Consolas,monospace" font-size="10" font-weight="700" text-anchor="middle">
    ${cells.join("")}
  </g>
  <text x="64" y="250" font-family="ui-sans-serif,system-ui,sans-serif" font-size="15" letter-spacing="4" fill="${mid}">OLYMPUS RESEARCH PRESENTS</text>
  <text x="60" y="312" font-family="ui-monospace,monospace" font-size="86" font-weight="800" fill="${bright}" letter-spacing="1">theseus</text>
  <text x="66" y="340" font-family="ui-sans-serif,system-ui,sans-serif" font-size="16" fill="${mid}">compare model × agent × harness — and judge the trade-offs</text>
</svg>\n`;
}

mkdirSync(OUT, { recursive: true });
const variants = [
  {
    name: "gold",
    seed: 7,
    bg: ["#0b1a2b", "#04080f"],
    dim: "#6b4f23",
    mid: "#c08a3e",
    bright: "#f5f1e6",
    bolt: "#f5f1e6",
  },
  {
    name: "blue",
    seed: 19,
    bg: ["#0a2550", "#03060d"],
    dim: "#16467a",
    mid: "#3aa0ff",
    bright: "#dbeeff",
    bolt: "#bfe0ff",
  },
];
for (const v of variants) writeFileSync(join(OUT, `c7-ascii-hero-${v.name}.svg`), build(v));
process.stdout.write("wrote c7-ascii-hero-gold.svg, c7-ascii-hero-blue.svg\n");