<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>새벽 · Shader Hero</title>
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
<!-- Filled by scripts/tokens.mjs --write from DESIGN.md. Every color below is a brand token; nothing is invented here. -->
<style id="hero-vars">:root{--hero-c0:#0b1026;--hero-c1:#ff6b3d;--hero-text:#ffffff;--hero-scrim:#0b1026;--hero-scrim-a:1;}</style>
<script type="application/json" id="hero-tokens">{"stops":["#0b1026","#ff6b3d"],"text":"#ffffff","scrim":"#0b1026","scrimAlpha":1,"source":"examples/DESIGN.example.md"}</script>
<style>
/* Background on html, never body: a body background paints over a fixed/negative-z scene (tf-shaders pitfall). */
html { background: var(--hero-c0); }
body { margin: 0; color: var(--hero-text);
font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
font-size: 1rem; line-height: 1.5; letter-spacing: 0; }
:lang(ko) { font-synthesis: none; }
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; overflow: hidden; isolation: isolate; }
/* Poster: the same two inks as a CSS halftone, laid out like the shader's shape. It is the first
paint and the no-WebGL2 path. Tone comes from dot SIZE in two hard-edged bands (4x4 squares in
the cores, 2x2 at the shoulders), never from alpha: a faded mask would blend brand over base.
Square dots on whole pixels, like the Bayer cells, so every poster pixel is one ink or the other. */
.hero-poster, .hero-scene { position: absolute; inset: 0; z-index: -2; }
.hero-poster { background: var(--hero-c0); }
.hero-poster::before, .hero-poster::after { content: ""; position: absolute; inset: 0; }
.hero-poster::before { background: conic-gradient(at 4px 4px, transparent 75%, var(--hero-c1) 0) 0 0 / 6px 6px; }
.hero-poster::after { background: conic-gradient(at 2px 2px, transparent 75%, var(--hero-c1) 0) 0 0 / 6px 6px; }
/* warp (default): folds of brand light gathered toward two corners */
.hero-poster::before {
-webkit-mask: radial-gradient(70% 80% at 12% 90%, #000 0 32%, transparent 0), radial-gradient(60% 70% at 92% 8%, #000 0 28%, transparent 0);
mask: radial-gradient(70% 80% at 12% 90%, #000 0 32%, transparent 0), radial-gradient(60% 70% at 92% 8%, #000 0 28%, transparent 0);
}
.hero-poster::after {
-webkit-mask: radial-gradient(70% 80% at 12% 90%, transparent 0 32%, #000 0 62%, transparent 0), radial-gradient(60% 70% at 92% 8%, transparent 0 28%, #000 0 56%, transparent 0);
mask: radial-gradient(70% 80% at 12% 90%, transparent 0 32%, #000 0 62%, transparent 0), radial-gradient(60% 70% at 92% 8%, transparent 0 28%, #000 0 56%, transparent 0);
}
/* ripple: the rings of Paper's ripple field at the still frame (8000ms, scale .5), radii in vmin
because the field is sized by the hero's shorter side. Cores where the field is > .7, shoulders .3-.7. */
.hero-scene[data-shape="ripple"] ~ .hero-poster::before {
--rings: radial-gradient(circle at 50% 50%, #000 0 25.1vmin, transparent 0 46.2vmin, #000 0 55.8vmin, transparent 0 70vmin, #000 0 77.5vmin, transparent 0 89.1vmin, #000 0 95.5vmin, transparent 0 105.7vmin, #000 0 111.3vmin, transparent 0 120.6vmin, #000 0 125.8vmin, transparent 0);
-webkit-mask: var(--rings); mask: var(--rings);
}
.hero-scene[data-shape="ripple"] ~ .hero-poster::after {
--rings: radial-gradient(circle at 50% 50%, transparent 0 25.1vmin, #000 0 30.3vmin, transparent 0 42.5vmin, #000 0 46.2vmin, transparent 0 55.8vmin, #000 0 59vmin, transparent 0 67.3vmin, #000 0 70vmin, transparent 0 77.5vmin, #000 0 80vmin, transparent 0 86.8vmin, #000 0 89.1vmin, transparent 0 95.5vmin, #000 0 97.6vmin, transparent 0 103.6vmin, #000 0 105.7vmin, transparent 0 111.3vmin, #000 0 113.3vmin, transparent 0 118.7vmin, #000 0 120.6vmin, transparent 0 125.8vmin, #000 0 127.6vmin, transparent 0);
-webkit-mask: var(--rings); mask: var(--rings);
}
.hero-scene { z-index: -1; opacity: 0; transition: opacity 600ms cubic-bezier(.22,1,.36,1); }
.hero-scene.is-ready { opacity: 1; }
.hero-copy { position: relative; max-width: min(72rem, 100% - 32px); padding: 0 16px; text-align: center; }
/* Knockout: an opaque base-ink panel behind the whole copy box, hard-edged like a print cut-out.
No translucent scrim and no feather: either would mix base over brand dots into mud. */
.hero-copy::before {
content: ""; position: absolute; inset: -2rem -2.5rem; z-index: -1; pointer-events: none;
background: color-mix(in srgb, var(--hero-scrim) calc(var(--hero-scrim-a) * 100%), transparent);
}
.hero h1 {
margin: 0; font-weight: 700;
font-size: clamp(2.6rem, 7vw, 6rem);
line-height: 1.3; /* /hangul HG-5: wrapping Korean display text stays >= 1.3 */
letter-spacing: -0.02em; /* HG-7: never below -0.03em */
word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance;
}
.hero p { margin: 1.2rem auto 0; max-width: 34em; font-size: clamp(1rem, 1.6vw, 1.25rem); word-break: keep-all; overflow-wrap: anywhere; }
.hero a {
display: inline-flex; align-items: center; min-height: 48px; margin-top: 2rem; padding: 0 1.5rem;
border-radius: 0; /* radius comes from DESIGN.md radius tokens; the fixture defines none */ background: var(--hero-text); color: var(--hero-c0); font-weight: 600; text-decoration: none;
}
.hero a:focus-visible { outline: 2px solid var(--hero-text); outline-offset: 3px; }
.hero small { position: absolute; left: 16px; bottom: 16px; font-size: 0.75rem; padding: .2rem .45rem; background: var(--hero-c0); } /* small text gets its own knockout too */
</style>
</head>
<body>
<section class="hero" aria-labelledby="hero-title">
<!-- The scene comes first so the poster CSS can follow its data-shape (z-index does the stacking). -->
<div class="hero-scene" aria-hidden="true" data-shape="warp" data-speed="0.3" data-px="3"></div>
<div class="hero-poster" aria-hidden="true"></div>
<div class="hero-copy">
<h1 id="hero-title">해가 뜨기 전, 가장 조용한 1분</h1>
<p>새벽은 아침 루틴을 하루 1분부터 쌓게 돕는 앱입니다.</p>
<a href="#">미리 받아보기</a>
</div>
<small>가상 브랜드 데모 · omd-shader-hero · 토큰: <span data-token-source></span></small>
</section>
<script type="module">
// Pinned per-file ESM builds of Paper Shaders (Apache-2.0, https://github.com/paper-design/shaders).
// Imported from the CDN, not vendored. Paper has no telemetry (its only fetch() reads a local blob's type).
import { ShaderMount } from 'https://cdn.jsdelivr.net/npm/@paper-design/shaders@0.0.82/dist/shader-mount.js/+esm';
import { ditheringFragmentShader, DitheringShapes, DitheringTypes } from 'https://cdn.jsdelivr.net/npm/@paper-design/shaders@0.0.82/dist/shaders/dithering.js/+esm';
const tokens = JSON.parse(document.getElementById('hero-tokens').textContent);
document.querySelector('[data-token-source]').textContent = tokens.source;
const el = document.querySelector('.hero-scene');
const hex = (h) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16) / 255).concat(1);
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const speed = reduce ? 0 : +el.dataset.speed; // param 1: how fast the field drifts (0 = still)
const px = +el.dataset.px; // param 2: dither cell size in CSS px (2 fine .. 6 coarse print)
const STILL_FRAME = 8000; // the composition reduced-motion users get (and the poster draws)
const [back, front] = tokens.stops; // base ink + exactly one brand ink: no blends, no mud
// data-shape picks the field: a choice of composition, not a third parameter. Each shape's scale is
// fixed so its riso cells read at px 2-6. Anything else falls back to warp.
const SHAPES = {
warp: { id: DitheringShapes.warp, scale: 1 }, // slow diagonal folds of brand light
ripple: { id: DitheringShapes.ripple, scale: 0.5 }, // concentric rings spreading from behind the copy
};
const shape = SHAPES[el.dataset.shape] ? el.dataset.shape : 'warp';
el.dataset.shape = shape; // keeps the poster CSS on the same composition
let mount = null;
const gl2 = (() => { try { return !!document.createElement('canvas').getContext('webgl2'); } catch { return false; } })();
if (gl2) {
try {
mount = new ShaderMount(el, ditheringFragmentShader, {
u_colorBack: hex(back),
u_colorFront: hex(front),
u_shape: SHAPES[shape].id,
u_type: DitheringTypes['4x4'], // ordered Bayer cells, the print look
u_pxSize: px,
// pattern sizing (Paper's defaultPatternSizing; ripple is centred on the hero, behind the copy)
u_fit: 0, u_scale: SHAPES[shape].scale, u_rotation: 0, u_offsetX: 0, u_offsetY: 0, u_originX: 0.5, u_originY: 0.5, u_worldWidth: 0, u_worldHeight: 0,
}, undefined, speed, STILL_FRAME, 1, 1920 * 1080); // minPixelRatio 1: the dither cell size is the resolution
requestAnimationFrame(() => requestAnimationFrame(() => el.classList.add('is-ready')));
} catch { mount = null; }
}
document.documentElement.dataset.hero = mount ? (reduce ? 'still' : 'shader') : 'poster';
window.__hero = { mount, tokens, shape };
</script>
</body>
</html>