Skip to content

The native runtime for three.js: three.js, down to the metal. 45× smaller than Electron, on a Sony PS3, and path-traced at 60 fps on ray-tracing GPUs.

18.0 KB
Raw Blame
/* ThreeRT visual system: tokens and the landing page's shared components.
   Dark "unlit" ink, warm bone text, one light colour (tungsten) that only ever means "traced light". */
@import url("https://fonts.googleapis.com/css2?family=Geist:[email protected]&family=Geist+Mono:[email protected]&display=swap");

:root {
  /* Ink: the unlit scene. */
  --ink-0: #060709;
  --ink-1: #0b0d11;
  --ink-2: #111419;
  --ink-3: #191c23;
  --ink-4: #262a33;
  --line: rgba(236, 232, 225, 0.1);
  --line-2: rgba(236, 232, 225, 0.2);
  /* Bone: light on plaster, the text colour. */
  --bone: #ece8e1;
  --bone-2: #bdb8af;
  --mute: #80858e;
  /* Tungsten: traced light. The only accent; never used for decoration that isn't light. */
  --ember: #ff6a13;
  --tungsten: #ffb454;
  --filament: #ffebc4;
  --ray: linear-gradient(100deg, var(--ember) 0%, var(--tungsten) 52%, var(--filament) 100%);
  /* The light where it pools on a surface (a lit card), and in code. */
  --halo: rgba(255, 140, 50, 0.13);
  --code-k: #ff9e64;
  --code-n: #ffd08a;
  /* three.js is neutral in comparisons (never red: it is the baseline, not the enemy). */
  --c-three: #8b919b;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-1: 10px;
  --r-2: 16px;
  --r-3: 24px;
  --wrap: 1240px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink-0);
  color: var(--bone);
  font: 400 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--tungsten); color: #111; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.mute { color: var(--mute); }
.ray-text { background: var(--ray); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.h-display { font-size: clamp(56px, 8.4vw, 124px); letter-spacing: -0.05em; line-height: 0.92; font-weight: 620; }
.h-1 { font-size: clamp(40px, 5vw, 72px); letter-spacing: -0.045em; line-height: 0.98; }
.h-3 { font-size: 22px; letter-spacing: -0.02em; line-height: 1.2; }
.lede { font-size: clamp(17px, 1.45vw, 20px); line-height: 1.5; color: var(--bone-2); max-width: 60ch; }
p { margin: 0; }

/* ---------- Brand lockup ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 20px; letter-spacing: -0.035em; }
.logo img, .logo svg.mark { width: 28px; height: 28px; }
.logo svg.mark { display: block; overflow: visible; }
.logo .rt { background: var(--ray); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Nav: Apps (threert.app) / Download / Docs / Star / Discord / X, the same on every page ---------- */
.nav { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); background: color-mix(in srgb, var(--ink-0) 72%, transparent); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.nav .links { display: flex; align-items: center; gap: 28px; margin-left: auto; font-size: 14.5px; font-weight: 500; color: var(--bone-2); }
.nav .links a { text-decoration: none; display: inline-flex; align-items: center; gap: 5px; padding: 6px 0; border-bottom: 1.5px solid transparent; transition: color 0.2s; }
.nav .links a:hover { color: var(--bone); }
.nav .links a[aria-current="page"] { color: var(--bone); border-bottom-color: var(--bone-2); }
/* A link that leaves for threert.app: an arrow after its words (scoped to svg so it does not collide with .reel .out). */
svg.out { display: block; flex: none; width: 9px; height: 9px; opacity: 0.6; transition: transform 0.2s var(--ease), opacity 0.2s; }
a:hover > svg.out { transform: translate(1px, -1px); opacity: 1; }
.btn svg.out { width: 10px; height: 10px; margin-left: -2px; opacity: 0.8; }
/* GitHub, Discord and X, as their marks. */
.si { display: block; width: 18px; height: 18px; flex: none; }
.nav .links a.ic { padding: 6px 0; }
.nav .links a.ic + a.ic { margin-left: -10px; }
/* Star on GitHub: the mark, the word, and the repository's count once js/site.js knows it (none until then). In the
   nav and the footer it is a small pill; on a .btn it is the button. */
.star b { font: 500 12.5px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--bone-2); padding-left: 9px; border-left: 1px solid var(--line-2); align-self: stretch; display: inline-flex; align-items: center; }
.star b[hidden] { display: none; }
.btn.star b { font-size: 13.5px; padding-left: 12px; margin: 12px 0; }
.nav .links a.star, .foot .site a.star { gap: 7px; height: 32px; padding: 0 12px 0 9px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--bone); font-size: 13.5px; font-weight: 500; line-height: 1; transition: border-color 0.2s, background 0.2s; }
.nav .links a.star:hover, .foot .site a.star:hover { border-color: var(--bone-2); }
.nav .links a.star .si, .foot .site a.star .si { width: 16px; height: 16px; }
.nav .links a.star b, .foot .site a.star b { margin: 8px 0; padding-left: 8px; }
.nav.overlay .links a.star { background: rgba(6, 7, 9, 0.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
a.star:focus-visible { border-radius: 999px; }
.nav.overlay { position: absolute; left: 0; right: 0; background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--tungsten); outline-offset: 3px; border-radius: 4px; }
.btn:focus-visible { border-radius: 999px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 20px; border-radius: 999px; font: 500 15px/1 var(--font-sans); text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--bone); color: var(--ink-0); }
.btn.ghost { border-color: var(--line-2); color: var(--bone); background: transparent; }
.btn.ghost:hover { border-color: var(--bone-2); }
.btn svg { flex: none; }
.btn.sm { height: 38px; padding: 0 16px; font-size: 14px; gap: 8px; }
.btn.off { border-color: var(--line); color: var(--mute); background: transparent; cursor: default; }
.btn.off:hover { transform: none; }
/* Under a row of buttons: what they are for (platforms, requirements). */
.plat { font: 400 12.5px/1.5 var(--font-mono); color: var(--mute); }

/* ---------- Wipe comparison ---------- */
.cmp { position: relative; width: 100%; overflow: hidden; border-radius: var(--r-2); background: #000; aspect-ratio: 16 / 9; user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: ew-resize; isolation: isolate; }
.cmp .pa, .cmp .pb { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cmp .pb { clip-path: inset(0 0 0 var(--x, 50%)); }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
/* A reel behind a page's opening words (js/threert.js, backdrop): a still, the clip over it once it plays. */
.backdrop { position: absolute; inset: 0; overflow: hidden; background: #000; }
.backdrop img, .backdrop video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.backdrop video { opacity: 0; transition: opacity 0.6s; }
.backdrop.playing video { opacity: 1; }
.backdrop .pp { position: absolute; z-index: 6; right: 32px; bottom: 30px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(236, 232, 225, 0.25); background: rgba(8, 9, 11, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #ece8e1; display: grid; place-items: center; cursor: pointer; padding: 0; opacity: 0.7; transition: opacity 0.2s; }
.backdrop .pp:hover, .backdrop .pp:focus-visible { opacity: 1; }
.backdrop .pp[hidden] { display: none; }
/* A clip over the stills (js/threert.js, clip): a canvas a pane, shown once it plays; its pause button. */
.cmp canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; opacity: 0; transition: opacity 0.5s; }
.cmp.playing canvas { opacity: 1; }
.cmp .pp { position: absolute; z-index: 6; right: 14px; bottom: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(236, 232, 225, 0.25); background: rgba(8, 9, 11, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #ece8e1; display: grid; place-items: center; cursor: pointer; padding: 0; opacity: 0.7; transition: opacity 0.2s; }
.cmp .pp:hover, .cmp .pp:focus-visible { opacity: 1; }
.cmp .pp[hidden] { display: none; }
.cmp.zoom img { transform: scale(var(--z, 2)); transform-origin: var(--o, 50% 50%); }
.cmp .bar, .seqp .bar { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 2px; margin-left: -1px; background: var(--filament); box-shadow: 0 0 18px 2px color-mix(in srgb, var(--tungsten) 65%, transparent); z-index: 3; pointer-events: none; }
.cmp .knob { position: absolute; top: 50%; left: var(--x, 50%); width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%; background: rgba(10, 11, 14, 0.66); border: 1.5px solid var(--filament); z-index: 4; display: grid; place-items: center; color: var(--filament); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; }
.lab { position: absolute; top: 14px; z-index: 5; display: inline-flex; align-items: flex-start; gap: 8px; padding: 7px 11px; border-radius: 8px; background: rgba(8, 9, 11, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font: 500 12px/1.25 var(--font-mono); color: #ece8e1; pointer-events: none; white-space: nowrap; }
.lab.a { left: 14px; }
.lab.b { right: 14px; text-align: right; flex-direction: row-reverse; }
.lab i { flex: none; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #8b919b; }
.lab.b i { background: var(--tungsten); box-shadow: 0 0 8px var(--tungsten); }
.lab small { display: block; opacity: 0.66; font-size: 11px; margin-top: 3px; }
.cmp:focus-visible { outline: 2px solid var(--tungsten); outline-offset: 3px; }

/* Figure caption */
.cap { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font: 400 12.5px/1.5 var(--font-mono); color: var(--mute); }
.cap b { color: var(--bone-2); font-weight: 500; }

/* ---------- Synced camera-move player ---------- */
.seqp { position: relative; width: 100%; border-radius: var(--r-2); overflow: hidden; background: #000; aspect-ratio: 16 / 9; cursor: ew-resize; touch-action: pan-y; }
.seqp canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.seqp .ctl { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 6; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; background: rgba(8, 9, 11, 0.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font: 500 12px/1 var(--font-mono); color: #ece8e1; cursor: default; }
.seqp .ctl button { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; width: 18px; height: 18px; display: grid; place-items: center; }
.seqp .ctl .track { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); position: relative; cursor: pointer; }
.seqp .ctl .track b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--tungsten); }
.seqp .loading { position: absolute; inset: 0; display: grid; place-items: center; font: 500 12px var(--font-mono); color: #80858e; z-index: 7; }

/* ---------- Code ---------- */
.code { font: 400 13.5px/1.7 var(--font-mono); color: #c9c4bb; background: #0a0b0e; border: 1px solid var(--line); border-radius: var(--r-2); padding: 20px 22px; overflow: auto; white-space: pre; tab-size: 2; }
.code .k { color: var(--code-k); }
.code .s { color: #b5d77b; }
.code .n { color: var(--code-n); }
.code .c { color: #5f646d; font-style: italic; }
.code .f { color: #8fc1ff; }
.code .hl { background: color-mix(in srgb, var(--tungsten) 10%, transparent); box-shadow: -22px 0 0 color-mix(in srgb, var(--tungsten) 10%, transparent), 22px 0 0 color-mix(in srgb, var(--tungsten) 10%, transparent); display: inline-block; width: 100%; }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 48px 0 64px; font-size: 13px; color: var(--mute); line-height: 1.6; }
.foot a { color: var(--bone-2); }
.foot .cols { display: grid; grid-template-columns: 1.2fr 2fr; gap: 48px; }
.foot .site { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: 14px; }
.foot .site { align-items: center; }
.foot .site a { text-decoration: none; }
.foot .site a { display: inline-flex; align-items: center; gap: 5px; }
/* Two rows whatever the width: the pages, then the Star button and the marks. */
.foot .site::before { content: ""; order: 1; flex-basis: 100%; height: 0; margin-top: 2px; }
.foot .site a.star, .foot .site a.ic { order: 2; }
.foot .site a.star { margin-right: -4px; }
.foot .site a.ic + a.ic { margin-left: -6px; }
.foot .site .si { width: 17px; height: 17px; }
.foot .legal { margin-top: 18px; }
.foot .legal a { text-decoration: none; }
.foot .legal a:hover { color: var(--bone); }
.foot .site a:hover { color: var(--bone); }
.foot .note { font: 400 12px/1.6 var(--font-mono); color: var(--mute); }
.foot .note p + p { margin-top: 12px; }

/* ---------- Pages under the landing page (Showcase, Download, Docs) ---------- */
.page-head { padding: 88px 0 56px; }
.page-head .wrap { display: grid; gap: 22px; }
.eyebrow { font: 500 12.5px/1 var(--font-mono); color: var(--mute); letter-spacing: 0.02em; }
.sec { padding: 0 0 112px; }
.sec-top { display: grid; gap: 14px; margin-bottom: 36px; }
.h-2 { font-size: clamp(30px, 3.4vw, 46px); letter-spacing: -0.04em; line-height: 1.04; }
.card { border: 1px solid var(--line); border-radius: 22px; background: var(--ink-1); padding: 30px; min-width: 0; }
.card.lit { border-color: color-mix(in srgb, var(--tungsten) 45%, transparent); background: radial-gradient(70% 90% at 70% 0%, var(--halo), transparent 70%), var(--ink-1); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.ticks li { position: relative; padding-left: 24px; color: var(--bone-2); font-size: 14.5px; line-height: 1.6; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--c-three); }
.card.lit .ticks li::before { background: var(--tungsten); box-shadow: 0 0 8px var(--tungsten); }
.kv { display: flex; flex-wrap: wrap; gap: 6px 20px; font: 400 12.5px/1.5 var(--font-mono); color: var(--mute); }
.kv b { color: var(--bone-2); font-weight: 500; }
.fine { font-size: 13.5px; line-height: 1.55; color: var(--mute); }
.fine a { color: var(--bone-2); }
code, kbd { font: 500 0.9em var(--font-mono); color: var(--bone); background: rgba(236, 232, 225, 0.07); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.code code { font: inherit; color: inherit; background: none; border: 0; padding: 0; white-space: inherit; }
/* A QR code: dark modules on a bone tile, so a phone reads it on the dark page. */
.qr { flex: none; width: 112px; height: 112px; padding: 7px; border-radius: 12px; background: var(--bone); display: grid; place-items: center; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr.lg { width: 168px; height: 168px; padding: 10px; border-radius: 16px; }
.qr:empty { background: var(--ink-3); }
/* Numbered steps, three across. */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); counter-reset: step; }
.steps > li { counter-increment: step; padding: 26px 32px 0 0; border-top: 1px solid var(--line-2); min-width: 0; }
.steps > li + li { padding-left: 32px; border-left: 1px solid var(--line); }
.steps > li::before { content: "0" counter(step); display: block; font: 500 12.5px/1 var(--font-mono); color: var(--tungsten); margin-bottom: 16px; }
.steps h3 { font: 600 24px/1.1 var(--font-sans); letter-spacing: -0.03em; }
.steps p { margin-top: 12px; color: var(--bone-2); font-size: 15.5px; max-width: 40ch; }

/* ---------- Reveal on scroll ---------- */
.rv { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

@media (max-width: 860px) {
  .wrap { padding: 0 20px; }
  .nav .wrap { gap: 16px; }
  .nav .links { gap: 20px; }
  .bars .row { grid-template-columns: 110px 1fr 48px; }
  .foot .cols { grid-template-columns: 1fr; }
  .page-head { padding: 56px 0 40px; }
  .sec { padding-bottom: 80px; }
  .steps { grid-template-columns: 1fr; }
  .steps > li { padding-right: 0; padding-bottom: 28px; }
  .steps > li + li { padding-left: 0; border-left: 0; }
  .card { padding: 22px; }
}
/* A phone: the mark alone stands for the lockup and GitHub's mark for the Star button, so the links fit on one line. */
@media (max-width: 520px) {
  .nav .logo > span { display: none; }
  .nav .links a.star { height: auto; padding: 6px 0; border: 0; background: none; }
  .nav .links a.star span, .nav .links a.star b { display: none; }
  .nav .links a.star .si { width: 18px; height: 18px; }
  .nav .links a.star + a.ic { margin-left: 0; }
  .nav .links { gap: 16px; font-size: 14px; }
  .nav .links a.ic + a.ic { margin-left: 0; }
  .nav .links { gap: 14px; }
}
/* The narrowest phones: three words and three marks still on one line. */
@media (max-width: 380px) {
  .nav .wrap { gap: 10px; }
  .nav .links { gap: 11px; font-size: 13px; }
  .nav .si { width: 16px; height: 16px; }
}
@media (max-width: 340px) {
  .nav .links { gap: 8px; font-size: 12.5px; }
}