mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-22 06:06:50 +08:00
The hero is now the Bean-head show from the hex-words prototype: an idle head and an option keycap until the visitor presses it, then a voiced demo of messages, OpenCode prompts and fixes, a Super Saiyan power-up and a Tommy-gun inbox wipe. - WebGPU with a Canvas 2D fallback; the engine chunk loads on idle or keycap intent, audio and its manifest only after the press. Poster still first, no layout shift. - Pauses when hidden or off screen, 30 fps idle, DPR cap, thinner on phones (the head slides right so OpenCode fits), reduced motion stays calm. - Real avatars for Dax, Jay and Frank; generated portraits for invented senders; real OpenCode, Hex, Scrawl, Effect, owner and brand icons (Simple Icons, Lucide). - Polish: badge-sized resolve check (was a 200 px ring), messages reply bubble sized with the right font, dizzy words below the head, head perks on the key press, master gain -1 dB so the pre-limiter mix no longer clips. - Open Graph card is now the app icon, name and one line.
38 lines
2.1 KiB
TypeScript
38 lines
2.1 KiB
TypeScript
// Renders the Open Graph / Twitter card (public/og.png, 1200 × 630): the app icon, the name,
|
||
// and one line. scripts/og/hex-icon.png is the 1024 px icon exported from the built Hex.app
|
||
// (iconutil -c iconset Hex.app/Contents/Resources/AppIcon.icns), so it carries Icon
|
||
// Composer's glass and shadow.
|
||
import { chromium } from "playwright"
|
||
import { readFileSync } from "node:fs"
|
||
import { fileURLToPath } from "node:url"
|
||
|
||
const icon = readFileSync(new URL("./og/hex-icon.png", import.meta.url)).toString("base64")
|
||
const font = readFileSync(new URL("../node_modules/@fontsource-variable/inter/files/inter-latin-wght-normal.woff2", import.meta.url)).toString("base64")
|
||
|
||
const html = `<!doctype html>
|
||
<style>
|
||
@font-face { font-family: Inter; src: url(data:font/woff2;base64,${font}) format("woff2"); font-weight: 100 900; }
|
||
html, body { margin: 0; width: 1200px; height: 630px; background: #070707; }
|
||
body {
|
||
display: flex; align-items: center; justify-content: center; gap: 48px; padding: 0 0 6px; box-sizing: border-box;
|
||
background: radial-gradient(circle at 390px 315px, rgba(255, 255, 255, 0.055), transparent 340px), #070707;
|
||
color: #f3f3f0; font-family: Inter, sans-serif; font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
|
||
-webkit-font-smoothing: antialiased;
|
||
}
|
||
img { width: 340px; height: 340px; margin-left: -24px; }
|
||
h1 { margin: 0; font-size: 112px; font-weight: 560; letter-spacing: -0.05em; line-height: 1; }
|
||
p { margin: 22px 0 0; color: #9b9da3; font-size: 32px; font-weight: 450; letter-spacing: -0.015em; line-height: 1.3; max-width: 15em; }
|
||
</style>
|
||
<img src="data:image/png;base64,${icon}" alt="">
|
||
<div><h1>Hex</h1><p>Local voice dictation for Mac, Windows, and Linux.</p></div>`
|
||
|
||
const browser = await chromium.launch({ headless: true })
|
||
try {
|
||
const page = await browser.newPage({ viewport: { width: 1200, height: 630 }, deviceScaleFactor: 1 })
|
||
await page.setContent(html)
|
||
await page.evaluate(() => document.fonts.ready)
|
||
await page.screenshot({ path: fileURLToPath(new URL("../public/og.png", import.meta.url)) })
|
||
} finally {
|
||
await browser.close()
|
||
}
|