Prompt specification
Build or customize the Three.js 3D scene "Tell Different Stories With One Set" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Tell Different Stories With One Set
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/tell-different-stories-with-one-set-x3324
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows camera framing, lighting, and photographic storytelling. Create a fictional room containing several related actions and objects. Let users change framing and reveal how excluded context can change an image's apparent narrative. Voxel style.
Working Three.js Starter (tell-different-stories-with-one-set-x3324):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Frame Study — The Unsent Letter</title>
<style>
:root {
--bg: #101719;
--panel: #172024;
--panel-2: #1d282c;
--paper: #f2eee4;
--muted: #8f9da1;
--line: rgba(226, 236, 232, 0.13);
--teal: #64d7ca;
--teal-dark: #183d3d;
--amber: #e6aa67;
--red: #b86155;
--ratio: 1.5;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
min-height: 100%;
margin: 0;
background: var(--bg);
color: var(--paper);
font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
overflow: hidden;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
button:focus-visible,
input:focus-visible {
outline: 2px solid var(--teal);
outline-offset: 3px;
}
.app-header {
height: 70px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
border-bottom: 1px solid var(--line);
background: #121a1d;
position: relative;
z-index: 5;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
min-width: 0;
}
.brand-mark {
width: 31px;
height: 31px;
border: 1px solid var(--teal);
position: relative;
transform: rotate(45deg);
flex: 0 0 auto;
}
.brand-mark::before,
.brand-mark::after {
content: "";
position: absolute;
background: var(--teal);
}
.brand-mark::before {
width: 1px;
height: 21px;
left: 14px;
top: 4px;
}
.brand-mark::after {
width: 21px;
height: 1px;
left: 4px;
top: 14px;
}
.brand-copy {
display: flex;
align-items: baseline;
gap: 12px;
min-width: 0;
}
.brand-title {
font-size: 12px;
font-weight: 800;
letter-spacing: 0.18em;
white-space: nowrap;
}
.brand-divider {
height: 16px;
width: 1px;
background: var(--line);
}
.scene-title {
color: #b8c2c4;
font-size: 12px;
letter-spacing: 0.08em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header-actions {
display: flex;
align-items: center;
gap: 15px;
}
.live-label {
display: flex;
align-items: center;
gap: 7px;
color: #aab6b8;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.14em;
}
.live-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--teal);
box-shadow: 0 0 12px var(--teal);
}
.download-button {
border: 1px solid var(--line);
background: transparent;
border-radius: 4px;
height: 34px;
padding: 0 13px;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.1em;
cursor: pointer;
transition: 160ms ease;
}
.download-button:hover {
border-color: var(--teal);
color: var(--teal);
background: rgba(100, 215, 202, 0.06);
}
.workspace {
height: calc(100vh - 70px);
display: grid;
grid-template-columns: minmax(0, 1fr) 365px;
}
.stage {
position: relative;
overflow: hidden;
background:
radial-gradient(circle at 48% 42%, rgba(75, 102, 106, 0.2), transparent 47%),
linear-gradient(145deg, #182226, #0d1316 72%);
}
.stage::before {
content: "";
position: absolute;
inset: 0;
opacity: 0.18;
pointer-events: none;
background-image:
linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
background-size: 32px 32px;
}
.frame-shell {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: #1b2528;
border: 1px solid rgba(224, 235, 231, 0.32);
box-shadow:
0 26px 70px rgba(0, 0, 0, 0.44),
0 0 0 7px rgba(0, 0, 0, 0.13);
overflow: hidden;
z-index: 1;
}
#canvasHost,
#canvasHost canvas {
width: 100%;
height: 100%;
display: block;
}
#canvasHost canvas {
cursor: grab;
touch-action: none;
}
#canvasHost canvas:active {
cursor: grabbing;
}
.frame-ui {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 3;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.frame-corner {
position: absolute;
width: 23px;
height: 23px;
border-color: rgba(255, 255, 255, 0.58);
border-style: solid;
}
.frame-corner.tl {
top: 12px;
left: 12px;
border-width: 1px 0 0 1px;
}
.frame-corner.tr {
top: 12px;
right: 12px;
border-width: 1px 1px 0 0;
}
.frame-corner.bl {
bottom: 12px;
left: 12px;
border-width: 0 0 1px 1px;
}
.frame-corner.br {
bottom: 12px;
right: 12px;
border-width: 0 1px 1px 0;
}
.frame-meta {
position: absolute;
top: 20px;
color: rgba(255, 255, 255, 0.86);
font-size: 9px;
letter-spacing: 0.12em;
text-shadow: 0 1px 4px #000;
}
.frame-meta.left {
left: 24px;
}
.frame-meta.right {
right: 24px;
text-align: right;
}
.frame-meta small {
display: block;
margin-top: 5px;
color: rgba(255, 255, 255, 0.55);
font-size: 8px;
}
.safe-guides {
position: absolute;
inset: 8%;
border: 1px dashed rgba(255, 255, 255, 0.15);
opacity: 0;
transition: opacity 180ms ease;
}
.frame-shell.grid-on .safe-guides {
opacity: 1;
}
.thirds {
position: absolute;
inset: 0;
opacity: 0;
transition: opacity 180ms ease;
background:
linear-gradient(to right, transparent 33.2%, rgba(255,255,255,.2) 33.2%, rgba(255,255,255,.2) 33.45%, transparent 33.45%, transparent 66.55%, rgba(255,255,255,.2) 66.55%, rgba(255,255,255,.2) 66.8%, transparent 66.8%),
linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,.2) 33.2%, rgba(255,255,255,.2) 33.45%, transparent 33.45%, transparent 66.55%, rgba(255,255,255,.2) 66.55%, rgba(255,255,255,.2) 66.8%, transparent 66.8%);
}
.frame-shell.grid-on .thirds {
opacity: 1;
}
.frame-bottom {
position: absolute;
left: 24px;
right: 24px;
bottom: 19px;
display: flex;
justify-content: space-between;
align-items: flex-end;
gap: 20px;
color: rgba(255, 255, 255, 0.72);
font-size: 8px;
letter-spacing: 0.1em;
text-shadow: 0 1px 4px #000;
}
.context-badge {
display: inline-flex;
align-items: center;
gap: 7px;
color: #f4c184;
}
.context-badge::before {
content: "";
width: 6px;
height: 6px;
border: 1px solid currentColor;
transform: rotate(45deg);
}
.context-badge.full {
color: var(--teal);
}
.object-labels {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 4;
}
.object-label {
position: absolute;
transform: translate(-50%, -100%);
display: none;
white-space: nowrap;
padding: 7px 9px;
color: #e8fffb;
background: rgba(13, 34, 35, 0.9);
border: 1px solid rgba(100, 215, 202, 0.7);
border-radius: 2px;
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.object-label::after {
content: "";
position: absolute;
left: 50%;
top: 100%;
width: 1px;
height: 17px;
background: var(--teal);
}
.object-label span {
display: block;
margin-top: 3px;
color: rgba(232, 255, 251, 0.58);
font-size: 7px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.stage-footer {
position: absolute;
left: 26px;
right: 26px;
bottom: 18px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
z-index: 5;
color: #718085;
font-size: 9px;
letter-spacing: 0.08em;
pointer-events: none;
}
.stage-footer kbd {
display: inline-block;
min-width: 19px;
padding: 3px 5px;
margin: 0 2px;
color: #a9b5b7;
background: rgba(255,255,255,.055);
border: 1px solid var(--line);
border-radius: 3px;
font: inherit;
text-align: center;
}
.inspector {
background: var(--panel);
border-left: 1px solid var(--line);
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #354347 transparent;
}
.inspector-section {
padding: 21px 22px;
border-bottom: 1px solid var(--line);
}
.section-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
}
.section-heading h2 {
margin: 0;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.section-number {
color: #627176;
font: 9px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.shots {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.shot-button {
min-width: 0;
display: grid;
grid-template-columns: 48px 1fr;
align-items: center;
gap: 9px;
padding: 8px;
border: 1px solid var(--line);
border-radius: 4px;
background: rgba(255, 255, 255, 0.025);
cursor: pointer;
text-align: left;
transition: 150ms ease;
}
.shot-button:hover {
border-color: rgba(100, 215, 202, 0.45);
background: rgba(100, 215, 202, 0.045);
}
.shot-button.active {
border-color: var(--teal);
background: var(--teal-dark);
}
.shot-button strong {
display: block;
color: #e5ece9;
font-size: 9px;
line-height: 1.25;
letter-spacing: 0.04em;
}
.shot-button small {
display: block;
margin-top: 3px;
color: #7f8d91;
font-size: 7px;
line-height: 1.2;
}
.mini-frame {
height: 35px;
border: 1px solid rgba(255,255,255,.28);
position: relative;
overflow: hidden;
background: #29383a;
}
.mini-frame::before {
content: "";
position: absolute;
background: #849594;
box-shadow: 4px 0 0 #3d5250, 8px 0 0 #3d5250;
width: 3px;
height: 13px;
left: 9px;
bottom: 4px;
}
.mini-frame::after {
content: "";
position: absolute;
width: 17px;
height: 3px;
background: #b39070;
left: 5px;
bottom: 6px;
}
.mini-frame.letter::before {
left: 16px;
bottom: 5px;
height: 7px;
width: 12px;
background: #e9e5d7;
box-shadow: none;
transform: rotate(-5deg);
}
.mini-frame.letter::after {
display: none;
}
.mini-frame.wide::before {
left: 26px;
box-shadow: 19px 0 0 #955f55;
}
.mini-frame.cups::before {
width: 5px;
height: 7px;
left: 12px;
background: #d6c4a4;
box-shadow: 13px 0 0 #d6c4a4;
}
.mini-frame.cups::after {
left: 8px;
bottom: 3px;
height: 2px;
}
.mini-frame.door::before {
left: 31px;
background: #a76b5f;
box-shadow: none;
height: 17px;
}
.mini-frame.door::after {
display: none;
}
.control-row {
margin-top: 17px;
}
.control-label {
display: flex;
justify-content: space-between;
margin-bottom: 9px;
color: #99a7aa;
font-size: 9px;
letter-spacing: 0.06em;
}
.control-label output {
color: var(--teal);
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
input[type="range"] {
width: 100%;
height: 3px;
appearance: none;
background: #354246;
border-radius: 3px;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
width: 13px;
height: 13px;
appearance: none;
border: 2px solid var(--teal);
border-radius: 50%;
background: #172024;
}
input[type="range"]::-moz-range-thumb {
width: 10px;
height: 10px;
border: 2px solid var(--teal);
border-radius: 50%;
background: #172024;
}
.segmented {
display: grid;
grid-template-columns: repeat(3, 1fr);
border: 1px solid var(--line);
border-radius: 4px;
overflow: hidden;
}
.segmented button {
min-height: 31px;
border: 0;
border-right: 1px solid var(--line);
background: transparent;
color: #819095;
font-size: 8px;
font-weight: 700;
letter-spacing: 0.08em;
cursor: pointer;
}
.segmented button:last-child {
border-right: 0;
}
.segmented button.active {
color: #e9f5f2;
background: rgba(100, 215, 202, 0.12);
}
.lighting-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.light-button {
padding: 11px 6px 10px;
border: 1px solid var(--line);
border-radius: 4px;
background: rgba(255, 255, 255, 0.025);
cursor: pointer;
transition: 150ms ease;
}
.light-button:hover {
border-color: rgba(100, 215, 202, 0.4);
}
.light-button.active {
border-color: var(--teal);
background: var(--teal-dark);
}
.light-swatch {
width: 26px;
height: 26px;
margin: 0 auto 8px;
border-radius: 50%;
box-shadow: 0 0 18px rgba(255,255,255,.08);
}
.light-swatch.day {
background: #b9d8df;
}
.light-swatch.lamp {
background: #e5a85d;
}
.light-swatch.flash {
background: #eef5ed;
box-shadow: 0 0 20px rgba(255,255,255,.38);
}
.light-button span:last-child {
color: #a8b4b6;
font-size: 8px;
font-weight: 700;
letter-spacing: 0.07em;
}
.light-button.active span:last-child {
color: #e9f5f2;
}
.narrative {
background:
linear-gradient(135deg, rgba(230, 170, 103, 0.08), transparent 58%),
#151e21;
}
.narrative-eyebrow {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
color: var(--amber);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.narrative-eyebrow::before {
content: "";
width: 16px;
height: 1px;
background: var(--amber);
}
#storyTitle {
margin: 0 0 9px;
color: #f1ede4;
font-family: Georgia, "Times New Roman", serif;
font-size: 24px;
font-weight: 400;
line-height: 1.08;
}
#storyBody {
margin: 0;
color: #aeb9ba;
font-size: 11px;
line-height: 1.65;
}
.omission {
margin-top: 17px;
padding-top: 14px;
border-top: 1px solid var(--line);
}
.omission-label {
margin-bottom: 5px;
color: #69777b;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
#omissionText {
margin: 0;
color: #c2cbca;
font-size: 10px;
line-height: 1.5;
}
.cue-heading {
display: flex;
justify-content: space-between;
margin: 16px 0 8px;
color: #758488;
font-size: 8px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.cue-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
min-height: 24px;
}
.cue-chip {
padding: 5px 7px;
color: #e3bb86;
background: rgba(230, 170, 103, 0.08);
border: 1px solid rgba(230, 170, 103, 0.2);
border-radius: 2px;
font-size: 8px;
}
.cue-chip.empty {
color: #83beb5;
background: rgba(100, 215, 202, 0.06);
border-color: rgba(100, 215, 202, 0.18);
}
.reveal-button {
width: 100%;
min-height: 42px;
margin-top: 18px;
border: 1px solid var(--teal);
border-radius: 4px;
background: var(--teal);
color: #10201f;
font-size: 9px;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
cursor: pointer;
transition: 160ms ease;
}
.reveal-button:hover {
background: #7de5d9;
box-shadow: 0 7px 22px rgba(100, 215, 202, 0.12);
}
.reveal-button.context-active {
color: var(--teal);
background: transparent;
}
.toggle-line {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 15px;
color: #8d9a9d;
font-size: 9px;
}
.switch {
position: relative;
width: 31px;
height: 17px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.switch-track {
position: absolute;
inset: 0;
border-radius: 20px;
background: #344145;
cursor: pointer;
transition: 160ms ease;
}
.switch-track::before {
content: "";
position: absolute;
width: 11px;
height: 11px;
left: 3px;
top: 3px;
border-radius: 50%;
background: #9eaaac;
transition: 160ms ease;
}
.switch input:checked + .switch-track {
background: var(--teal-dark);
}
.switch input:checked + .switch-track::before {
transform: translateX(14px);
background: var(--teal);
}
.credits {
padding: 16px 22px 24px;
color: #59676b;
font-size: 8px;
line-height: 1.6;
letter-spacing: 0.07em;
}
@media (max-width: 980px) {
body {
overflow: auto;
}
.workspace {
height: auto;
grid-template-columns: 1fr;
}
.stage {
height: 68vh;
min-height: 520px;
}
.inspector {
border-left: 0;
border-top: 1px solid var(--line);
overflow: visible;
}
.brand-divider,
.scene-title,
.live-label {
display: none;
}
}
@media (max-width: 560px) {
.app-header {
height: 62px;
padding: 0 15px;
}
.workspace {
min-height: calc(100vh - 62px);
}
.stage {
height: 62vh;
min-height: 430px;
}
.inspector-section {
padding: 19px 16px;
}
.shots {
grid-template-columns: 1fr;
}
.stage-footer {
left: 14px;
right: 14px;
bottom: 10px;
font-size: 7px;
}
.stage-footer .shortcut-hint {
display: none;
}
.frame-meta {
font-size: 7px;
}
.frame-meta.left,
.frame-meta.right {
top: 16px;
}
.frame-meta.left {
left: 17px;
}
.frame-meta.right {
right: 17px;
}
}
</style>
</head>
<body>
<header class="app-header">
<div class="brand">
<div class="brand-mark" aria-hidden="true"></div>
<div class="brand-copy">
<div class="brand-title">FRAME STUDY</div>
<div class="brand-divider"></div>
<div class="scene-title">ROOM 04 / THE UNSENT LETTER</div>
</div>
</div>
<div class="header-actions">
<div class="live-label"><span class="live-dot"></span>LIVE VOXEL SET</div>
<button class="download-button" id="downloadButton" type="button">SAVE FRAME</button>
</div>
</header>
<main class="workspace">
<section class="stage" id="stage" aria-label="Interactive 3D room">
<div class="frame-shell grid-on" id="frameShell">
<div id="canvasHost"></div>
<div class="frame-ui">
<div class="frame-corner tl"></div>
<div class="frame-corner tr"></div>
<div class="frame-corner bl"></div>
<div class="frame-corner br"></div>
<div class="safe-guides"></div>
<div class="thirds"></div>
</div>
<div class="frame-meta left">
<div id="frameName">FRAME 02 / THE PERSON WHO STAYS</div>
<small>APERTURE STUDY · 24.7 MM</small>
</div>
<div class="frame-meta right">
<div id="lensMeta">50 MM · f/5.6 · 1/60</div>
<small id="lightMeta">EVEN WINDOW LIGHT</small>
</div>
<div class="frame-bottom">
<div id="frameMood">WAITING / SOLITUDE</div>
<div class="context-badge" id="contextBadge">3 CUES OUTSIDE FRAME</div>
</div>
<div class="object-labels" id="objectLabels"></div>
</div>
<div class="stage-footer">
<div>DRAG TO ORBIT · SCROLL TO DOLLY · SHIFT-DRAG TO PAN</div>
<div class="shortcut-hint"><kbd>1</kbd>–<kbd>5</kbd> SHOTS · <kbd>L</kbd> LIGHT · <kbd>R</kbd> CONTEXT</div>
</div>
</section>
<aside class="inspector" aria-label="Camera and narrative controls">
<section class="inspector-section">
<div class="section-heading">
<h2>Composition</h2>
<span class="section-number">01 / CAMERA</span>
</div>
<div class="shots">
<button class="shot-button" data-shot="letter" type="button">
<span class="mini-frame letter"></span>
<span><strong>Letter</strong><small>Object detail</small></span>
</button>
<button class="shot-button active" data-shot="medium" type="button">
<span class="mini-frame"></span>
<span><strong>The writer</strong><small>Medium portrait</small></span>
</button>
<button class="shot-button" data-shot="wide" type="button">
<span class="mini-frame wide"></span>
<span><strong>Two people</strong><small>Room context</small></span>
</button>
<button class="shot-button" data-shot="cups" type="button">
<span class="mini-frame cups"></span>
<span><strong>Two cups</strong><small>Implied company</small></span>
</button>
<button class="shot-button" data-shot="door" type="button">
<span class="mini-frame door"></span>
<span><strong>Doorway</strong><small>Departure cue</small></span>
</button>
</div>
<div class="control-row">
<label class="control-label" for="lensRange">
<span>FOCAL LENGTH</span>
<output id="lensOutput">50 MM</output>
</label>
<input id="lensRange" type="range" min="28" max="85" value="50" />
</div>
<div class="control-row">
<div class="control-label"><span>ASPECT RATIO</span><output id="aspectOutput">3 : 2</output></div>
<div class="segmented" id="aspectControls">
<button class="active" data-aspect="1.5" type="button">3 : 2</button>
<button data-aspect="1" type="button">1 : 1</button>
<button data-aspect="1.777777" type="button">16 : 9</button>
</div>
</div>
</section>
<section class="inspector-section">
<div class="section-heading">
<h2>Lighting</h2>
<span class="section-number">02 / TONE</span>
</div>
<div class="lighting-grid" id="lightingControls">
<button class="light-button active" data-light="day" type="button">
<span class="light-swatch day"></span>
<span>WINDOW</span>
</button>
<button class="light-button" data-light="lamp" type="button">
<span class="light-swatch lamp"></span>
<span>LAMP</span>
</button>
<button class="light-button" data-light="flash" type="button">
<span class="light-swatch flash"></span>
<span>FLASH</span>
</button>
</div>
<div class="control-row">
<label class="control-label" for="exposureRange">
<span>EXPOSURE</span>
<output id="exposureOutput">+0.0 EV</output>
</label>
<input id="exposureRange" type="range" min="-0.8" max="1.2" step="0.1" value="0" />
</div>
<div class="toggle-line">
<span>Composition guides</span>
<label class="switch">
<input id="gridToggle" type="checkbox" checked />
<span class="switch-track"></span>
</label>
</div>
</section>
<section class="inspector-section narrative">
<div class="narrative-eyebrow">Apparent story</div>
<h2 id="storyTitle">Waiting, or being left?</h2>
<p id="storyBody" aria-live="polite">
One figure writes beneath a narrow pool of light. Because the room is cropped,
the image suggests waiting; context might make it feel like abandonment.
</p>
<div class="omission">
<div class="omission-label">What this frame leaves out</div>
<p id="omissionText">The doorway figure and packed case sit beyond the right edge.</p>
</div>
<div class="cue-heading">
<span>Excluded visual cues</span>
<span id="cueCount">03 FOUND</span>
</div>
<div class="cue-list" id="cueList"></div>
<button class="reveal-button" id="revealButton" type="button">REVEAL OUTSIDE THE FRAME</button>
</section>
<div class="credits">
A fictional room built entirely from voxels. Every crop is a different argument about what happened.
Drag the image to inspect, then widen the story.
</div>
</aside>
</main>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const frameShell = document.getElementById("frameShell");
const canvasHost = document.getElementById("canvasHost");
const objectLabels = document.getElementById("objectLabels");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x172125);
scene.fog = new THREE.Fog(0x172125, 17, 35);
const camera = new THREE.PerspectiveCamera(40, 1.5, 0.1, 100);
const renderer = new THREE.WebGLRenderer({
antialias: true,
preserveDrawingBuffer: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
canvasHost.appendChild(renderer.domElement);
const state = {
shot: "medium",
lens: 50,
aspect: 1.5,
exposure: 0,
light: "day",
contextMode: false,
savedFrame: null,
contextSnapshot: []
};
const currentTarget = new THREE.Vector3(-1.3, 1.35, -1.3);
let cameraTween = null;
let pointerDown = false;
let pointerMoved = false;
let lastPointer = { x: 0, y: 0 };
let lastContextUpdate = 0;
const shots = {
letter: {
label: "FRAME 01 / THE UNSENT LETTER",
short: "LETTER",
pos: [-0.15, 3.45, 1.65],
target: [-1.25, 1.7, -2.55],
lens: 70,
mood: "PRIVATE DECISION",
title: "A decision, without a person",
body: "The paper fills the frame, so it reads as a solitary choice. The writer is reduced to an unseen mind.",
omission: "The seated writer and the doorway are both hidden.",
lightText: {
day: "Cool, even light supports the most neutral reading.",
lamp: "A warm pool of light makes the private gesture feel intimate.",
flash: "The hard flash freezes the note like evidence."
}
},
medium: {
label: "FRAME 02 / THE PERSON WHO STAYS",
short: "WRITER",
pos: [6.4, 5.15, 7.75],
target: [-1.35, 1.35, -1.45],
lens: 50,
mood: "WAITING / SOLITUDE",
title: "Waiting, or being left?",
body: "One figure writes beneath a narrow pool of light. Because the room is cropped, the image suggests waiting; context might make it feel like abandonment.",
omission: "The doorway figure and packed case sit beyond the right edge.",
lightText: {
day: "Cool, even light supports the most neutral reading.",
lamp: "A warm pool of light makes the waiting feel intimate—and therefore private.",
flash: "The hard flash turns the posture into a moment of evidence."
}
},
wide: {
label: "FRAME 03 / TWO PEOPLE, ONE ROOM",
short: "ROOM",
pos: [10.4, 8.15, 13.1],
target: [0.25, 1.4, -1.45],
lens: 39,
mood: "SEPARATION / DEPARTURE",
title: "Two people, one decision",
body: "Now the image holds both bodies at once: one writes, one waits with a case. The note appears to belong to a departure.",
omission: "Nothing major is excluded—the relationship is visible.",
lightText: {
day: "The broad room makes the separation feel factual.",
lamp: "Warm light connects the two figures spatially while emphasizing their distance.",
flash: "The flash turns the tableau into a frozen record of departure."
}
},
cups: {
label: "FRAME 04 / THE END OF A CONVERSATION",
short: "CUPS",
pos: [2.15, 2.9, 0.85],
target: [-1.65, 1.72, -2.68],
lens: 70,
mood: "COMPANY / AFTERMATH",
title: "The end of a conversation",
body: "Two cups suggest company, but the people have been cropped into objects. The photograph can imply an ordinary goodbye.",
omission: "Both figures are absent; only their cups remain.",
lightText: {
day: "Clear light makes the empty chairs and cups feel ordinary.",
lamp: "Warm light gives the abandoned cups a sense of lingering affection.",
flash: "The flash makes the still life feel detached from its people."
}
},
door: {
label: "FRAME 05 / THE DEPARTURE",
short: "DOOR",
pos: [7.35, 4.25, 3.05],
target: [4.05, 1.55, -2.7],
lens: 58,
mood: "EXIT / FINALITY",
title: "A departure caught in time",
body: "The case and turned body point toward the exit. Without the writer, the movement feels final.",
omission: "The writer is excluded, making the exit feel unopposed.",
lightText: {
day: "Daylight gives the departure a clean, matter-of-fact quality.",
lamp: "The lamp stays behind with the room while the figure moves toward darkness.",
flash: "A frontal flash turns the doorway into a stark final gesture."
}
}
};
const lightPresets = {
day: {
hemi: 1.55,
key: 2.7,
lamp: 1.5,
flash: 0,
keyColor: 0xc9e1ef,
hemiColor: 0xb9d7dd,
groundColor: 0x5c5149,
exposure: 1.02,
label: "EVEN WINDOW LIGHT"
},
lamp: {
hemi: 0.32,
key: 0.18,
lamp: 28,
flash: 0,
keyColor: 0xb8d1dc,
hemiColor: 0x50636a,
groundColor: 0x3d3028,
exposure: 1.14,
label: "SINGLE WARM LAMP"
},
flash: {
hemi: 0.22,
key: 0.08,
lamp: 0.2,
flash: 4.3,
keyColor: 0xd9e5e4,
hemiColor: 0x829193,
groundColor: 0x252929,
exposure: 0.96,
label: "HARD DIRECT FLASH"
}
};
const lightState = {
hemi: lightPresets.day.hemi,
key: lightPresets.day.key,
lamp: lightPresets.day.lamp,
flash: lightPresets.day.flash,
exposure: lightPresets.day.exposure,
keyColor: new THREE.Color(lightPresets.day.keyColor),
hemiColor: new THREE.Color(lightPresets.day.hemiColor),
groundColor: new THREE.Color(lightPresets.day.groundColor)
};
const hemiLight = new THREE.HemisphereLight(
lightState.hemiColor,
lightState.groundColor,
lightState.hemi
);
scene.add(hemiLight);
const keyLight = new THREE.DirectionalLight(lightState.keyColor, lightState.key);
keyLight.position.set(4.5, 8.5, 5.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -9;
keyLight.shadow.camera.right = 9;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -9;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 30;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
scene.add(keyLight.target);
const flashLight = new THREE.DirectionalLight(0xf2f4ed, 0);
flashLight.castShadow = true;
flashLight.shadow.mapSize.set(1024, 1024);
flashLight.shadow.camera.left = -7;
flashLight.shadow.camera.right = 7;
flashLight.shadow.camera.top = 7;
flashLight.shadow.camera.bottom = -7;
flashLight.shadow.bias = -0.0006;
scene.add(flashLight);
scene.add(flashLight.target);
const lampLight = new THREE.PointLight(0xffb55c, lightState.lamp, 7, 2);
lampLight.position.set(-3.02, 2.65, -2.63);
scene.add(lampLight);
const contextItems = [];
const edgeMaterial = new THREE.LineBasicMaterial({
color: 0x172326,
transparent: true,
opacity: 0.16
});
function material(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0,
...options
});
}
function box(parent, sx, sy, sz, x, y, z, color, options = {}, outline = false) {
const mat = options.material || material(color, options);
const mesh = new THREE.Mesh(new THREE.BoxGeometry(sx, sy, sz), mat);
mesh.position.set(x, y, z);
mesh.castShadow = options.castShadow !== false;
mesh.receiveShadow = options.receiveShadow !== false;
parent.add(mesh);
if (outline) {
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(mesh.geometry),
edgeMaterial
);
mesh.add(edges);
}
return mesh;
}
function groupAt(x, y, z) {
const group = new THREE.Group();
group.position.set(x, y, z);
scene.add(group);
return group;
}
function registerContext(id, name, note, group, anchorPosition) {
const anchor = new THREE.Object3D();
anchor.position.set(...anchorPosition);
group.add(anchor);
const helper = new THREE.BoxHelper(group, 0x64d7ca);
helper.material.transparent = true;
helper.material.opacity = 0.8;
helper.material.depthTest = false;
helper.renderOrder = 10;
helper.visible = false;
scene.add(helper);
const label = document.createElement("div");
label.className = "object-label";
label.innerHTML = `${name}<span>${note}</span>`;
objectLabels.appendChild(label);
contextItems.push({ id, name, note, group, anchor, helper, label });
}
// Room shell: intentionally open at the front and right for a cutaway view.
const room = new THREE.Group();
scene.add(room);
box(room, 11.7, 0.34, 8.6, 0, -0.17, 0, 0x77746c, {}, true);
box(room, 11.5, 4.65, 0.22, 0, 2.325, -4.25, 0x879a98, {}, true);
box(room, 0.22, 4.65, 8.5, -5.65, 2.325, 0, 0x788b89, {}, true);
// Wall trim and floor planks.
box(room, 11.45, 0.18, 0.12, 0, 0.75, -4.09, 0x657775);
for (let i = -5; i <= 5; i++) {
box(room, 0.018, 0.012, 8.35, i * 1.05, 0.008, 0, 0x686a65);
}
// Rug.
box(room, 5.25, 0.035, 3.55, -1.25, 0.025, -0.7, 0x985d52);
box(room, 4.85, 0.012, 3.15, -1.25, 0.047, -0.7, 0xab6d5d);
for (let i = 0; i < 7; i++) {
box(room, 0.07, 0.014, 2.7, -3.2 + i * 0.62, 0.06, -0.7, 0xc58a70);
}
// Window.
const windowGroup = groupAt(0.35, 0, -4.02);
const windowMaterial = material(0x466a78, {
emissive: 0x416f7c,
emissiveIntensity: 0.65,
roughness: 0.55
});
box(windowGroup, 2.65, 2.05, 0.09, 0, 2.78, 0, 0xffffff, { material: windowMaterial });
box(windowGroup, 2.9, 0.14, 0.14, 0, 3.83, 0.04, 0xd6d1c1);
box(windowGroup, 2.9, 0.14, 0.14, 0, 1.73, 0.04, 0xd6d1c1);
box(windowGroup, 0.14, 2.2, 0.14, -1.38, 2.78, 0.04, 0xd6d1c1);
box(windowGroup, 0.14, 2.2, 0.14, 1.38, 2.78, 0.04, 0xd6d1c1);
box(windowGroup, 0.1, 2.05, 0.14, 0, 2.78, 0.06, 0xd6d1c1);
box(windowGroup, 2.65, 0.1, 0.14, 0, 2.78, 0.06, 0xd6d1c1);
registerContext("window", "Rain-dark window", "late hour / weather", windowGroup, [0, 2.8, 0.15]);
// Door and frame.
box(room, 1.8, 3.7, 0.16, 4.15, 1.85, -4.06, 0x29383a);
box(room, 0.16, 3.9, 0.25, 3.17, 1.95, -3.98, 0x5c6460);
box(room, 0.16, 3.9, 0.25, 5.13, 1.95, -3.98, 0x5c6460);
box(room, 2.12, 0.16, 0.25, 4.15, 3.88, -3.98, 0x5c6460);
box(room, 0.08, 0.08, 0.09, 3.54, 1.7, -3.93, 0xc5a269);
// Writing desk.
const desk = groupAt(-1.55, 0, -2.9);
box(desk, 3.8, 0.18, 1.35, 0, 1.56, 0, 0xa67858, {}, true);
box(desk, 0.18, 1.55, 0.18, -1.63, 0.76, -0.48, 0x654c3e);
box(desk, 0.18, 1.55, 0.18, 1.63, 0.76, -0.48, 0x654c3e);
box(desk, 0.18, 1.55, 0.18, -1.63, 0.76, 0.48, 0x654c3e);
box(desk, 0.18, 1.55, 0.18, 1.63, 0.76, 0.48, 0x654c3e);
box(desk, 0.83, 0.78, 1.0, 1.22, 1.08, 0, 0x8b644d, {}, true);
for (let i = 0; i < 3; i++) {
box(desk, 0.74, 0.02, 0.03, 1.22, 0.84 + i * 0.25, 0.515, 0x584539);
box(desk, 0.22, 0.04, 0.05, 1.22, 0.86 + i * 0.25, 0.54, 0xd0ad70);
}
// Chair and seated writer.
const seated = groupAt(-1.45, 0, -1.25);
box(seated, 1.05, 0.16, 0.98, 0, 0.68, 0.08, 0x526d69, {}, true);
box(seated, 1.05, 1.35, 0.14, 0, 1.25, 0.5, 0x526d69, {}, true);
box(seated, 0.13, 0.75, 0.13, -0.42, 0.3, 0.1, 0x394d4b);
box(seated, 0.13, 0.75, 0.13, 0.42, 0.3, 0.1, 0x394d4b);
box(seated, 0.13, 0.75, 0.13, -0.42, 0.3, 0.48, 0x394d4b);
box(seated, 0.13, 0.75, 0.13, 0.42, 0.3, 0.48, 0x394d4b);
// Coat over the chair.
box(seated, 0.68, 0.85, 0.18, -0.22, 1.13, 0.65, 0x3c505b, {}, true);
box(seated, 0.22, 0.55, 0.2, -0.47, 0.83, 0.66, 0x3c505b);
// Figure.
box(seated, 0.78, 1.03, 0.52, 0, 1.37, -0.08, 0x526f83, {}, true);
box(seated, 0.63, 0.26, 0.53, 0, 1.72, -0.08, 0x607b8c);
box(seated, 0.55, 0.58, 0.52, 0, 2.18, -0.09, 0xc69772, {}, true);
box(seated, 0.59, 0.2, 0.54, 0, 2.43, -0.08, 0x3c302d);
box(seated, 0.48, 0.32, 0.12, 0, 2.48, -0.4, 0x3c302d);
box(seated, 0.25, 0.58, 0.28, -0.52, 1.52, -0.16, 0x607b8c);
box(seated, 0.25, 0.58, 0.28, 0.52, 1.52, -0.16, 0x607b8c);
box(seated, 0.22, 0.22, 0.82, -0.51, 1.18, -0.53, 0xc69772, {}, true);
box(seated, 0.22, 0.22, 0.82, 0.51, 1.18, -0.53, 0xc69772, {}, true);
box(seated, 0.72, 0.25, 1.05, 0, 0.8, -0.47, 0x394f5d);
box(seated, 0.27, 0.7, 0.28, -0.23, 0.42, -0.82, 0x303a40);
box(seated, 0.27, 0.7, 0.28, 0.23, 0.42, -0.82, 0x303a40);
registerContext("writer", "The seated writer", "waiting / staying", seated, [0, 1.65, 0]);
// Letter and pen.
const letter = groupAt(-1.12, 1.67, -2.55);
const paper = box(letter, 1.0, 0.035, 0.68, 0, 0, 0, 0xe9e4d8);
paper.rotation.y = -0.09;
box(letter, 0.58, 0.012, 0.025, -0.08, 0.025, -0.12, 0x9b9589);
box(letter, 0.46, 0.012, 0.025, -0.14, 0.025, 0.03, 0x9b9589);
box(letter, 0.5, 0.012, 0.025, -0.1, 0.025, 0.16, 0x9b9589);
const pen = box(letter, 0.52, 0.04, 0.045, 0.44, 0.05, -0.12, 0x324b5a);
pen.rotation.y = 0.22;
// Two cups.
const cups = groupAt(-1.55, 1.69, -2.64);
for (const x of [-0.83, 0.83]) {
box(cups, 0.34, 0.4, 0.34, x, 0.18, 0, 0xd7c3a3, {}, true);
box(cups, 0.27, 0.018, 0.27, x, 0.39, 0, 0x4f382c);
box(cups, 0.12, 0.25, 0.09, x + 0.22, 0.22, 0, 0xd7c3a3);
box(cups, 0.07, 0.19, 0.09, x + 0.29, 0.22, 0, 0xd7c3a3);
}
registerContext("cups", "Two cups", "company implied", cups, [0, 0.45, 0.2]);
// Desk lamp.
const lamp = groupAt(-3.05, 1.66, -2.65);
box(lamp, 0.48, 0.08, 0.48, 0, 0.04, 0, 0x465452);
box(lamp, 0.1, 0.78, 0.1, 0, 0.43, 0, 0x465452);
box(lamp, 0.44, 0.08, 0.12, 0.2, 0.8, 0, 0x465452);
const lampShadeMaterial = material(0xd79d56, {
emissive: 0xffa94c,
emissiveIntensity: 0.2,
roughness: 0.7
});
box(lamp, 0.48, 0.33, 0.48, 0.36, 0.93, 0, 0xffffff, {
material: lampShadeMaterial
}, true);
// Books and stationery.
box(desk, 0.75, 0.12, 0.52, -1.23, 1.72, 0.2, 0x485f69);
box(desk, 0.68, 0.11, 0.48, -1.19, 1.83, 0.17, 0xb27b5d);
box(desk, 0.45, 0.06, 0.38, 0.74, 1.69, -0.32, 0xc9c0aa);
// Departing figure.
const departing = groupAt(4.1, 0, -3.05);
box(departing, 0.85, 1.4, 0.57, 0, 1.53, 0, 0x76524d, {}, true);
box(departing, 0.92, 0.25, 0.64, 0, 2.05, 0, 0x654740);
box(departing, 0.57, 0.59, 0.56, 0, 2.48, 0, 0xb88767, {}, true);
box(departing, 0.6, 0.19, 0.58, 0, 2.74, 0, 0x302a28);
box(departing, 0.22, 0.4, 0.2, 0.3, 2.52, 0, 0x302a28);
box(departing, 0.28, 1.12, 0.31, -0.25, 0.52, 0, 0x333b3e);
box(departing, 0.28, 1.12, 0.31, 0.25, 0.52, 0, 0x333b3e);
box(departing, 0.32, 0.18, 0.54, -0.25, -0.06, -0.13, 0x252c2e);
box(departing, 0.32, 0.18, 0.54, 0.25, -0.06, -0.13, 0x252c2e);
box(departing, 0.25, 0.78, 0.29, -0.56, 1.58, 0.13, 0x76524d);
box(departing, 0.24, 0.24, 0.78, -0.58, 1.18, 0.51, 0xb88767);
box(departing, 0.24, 0.83, 0.29, 0.56, 1.57, 0, 0x76524d);
registerContext("departing", "Person at the door", "departure / withheld", departing, [0, 1.75, 0]);
// Suitcase.
const suitcase = groupAt(4.12, 0, -1.65);
box(suitcase, 1.02, 1.18, 0.56, 0, 0.63, 0, 0x6d6254, {}, true);
box(suitcase, 0.08, 0.88, 0.05, 0, 0.64, 0.3, 0x3e3e39);
box(suitcase, 0.08, 0.08, 0.62, -0.44, 0.62, 0, 0x3e3e39);
box(suitcase, 0.08, 0.08, 0.62, 0.44, 0.62, 0, 0x3e3e39);
box(suitcase, 0.07, 0.62, 0.07, -0.27, 1.5, 0, 0x9b927e);
box(suitcase, 0.07, 0.62, 0.07, 0.27, 1.5, 0, 0x9b927e);
box(suitcase, 0.61, 0.08, 0.08, 0, 1.8, 0, 0x9b927e);
registerContext("suitcase", "Packed case", "evidence of leaving", suitcase, [0, 1.2, 0]);
// Slippers and a small plant.
box(room, 0.32, 0.15, 0.65, 3.55, 0.09, -1.05, 0x7b918a, {}, true);
box(room, 0.32, 0.15, 0.65, 3.95, 0.09, -1.05, 0x7b918a, {}, true);
const plant = groupAt(-4.78, 0, -3.25);
box(plant, 0.66, 0.62, 0.66, 0, 0.31, 0, 0x9b6d55, {}, true);
box(plant, 0.08, 1.2, 0.08, 0, 1.12, 0, 0x4a6b56);
box(plant, 0.78, 0.38, 0.3, 0, 1.45, 0, 0x527b62, {}, true);
box(plant, 0.34, 0.62, 0.65, 0.18, 1.5, 0, 0x668d70, {}, true);
box(plant, 0.5, 0.3, 0.36, -0.25, 1.78, 0.05, 0x789b79, {}, true);
// Wall clock.
const clock = groupAt(2.2, 3.55, -4.01);
box(clock, 0.75, 0.75, 0.12, 0, 0, 0, 0xd3c9b3, {}, true);
box(clock, 0.05, 0.28, 0.04, 0, 0.1, 0.08, 0x39413e);
const minuteHand = box(clock, 0.035, 0.22, 0.04, 0.08, 0.08, 0.085, 0x39413e);
minuteHand.rotation.z = -0.7;
registerContext("clock", "11:47", "the hour is late", clock, [0, 0, 0.15]);
// Small framed photograph.
const photo = groupAt(-3.15, 3.05, -4.0);
box(photo, 0.92, 0.72, 0.09, 0, 0, 0, 0xa27c5a, {}, true);
box(photo, 0.72, 0.52, 0.04, 0, 0, 0.065, 0x71888a);
box(photo, 0.25, 0.35, 0.05, -0.12, 0, 0.095, 0xc09576);
box(photo, 0.23, 0.32, 0.05, 0.2, -0.02, 0.095, 0xd4b592);
// Additional wall cube details.
box(room, 1.9, 0.1, 0.12, -1.0, 4.16, -4.04, 0x5f706f);
box(room, 0.12, 0.1, 1.15, -2.1, 4.13, -3.55, 0x5f706f);
box(room, 0.12, 0.1, 1.15, 0.1, 4.13, -3.55, 0x5f706f);
function focalToFov(focalLength) {
return THREE.MathUtils.radToDeg(
2 * Math.atan(24 / (2 * focalLength))
);
}
function setLens(value) {
state.lens = THREE.MathUtils.clamp(Number(value), 28, 85);
camera.fov = focalToFov(state.lens);
camera.updateProjectionMatrix();
document.getElementById("lensRange").value = state.lens;
document.getElementById("lensOutput").textContent = `${Math.round(state.lens)} MM`;
document.getElementById("lensMeta").textContent =
`${Math.round(state.lens)} MM · f/5.6 · 1/60`;
}
function updateNarrative() {
if (state.contextMode) {
document.getElementById("storyTitle").textContent = "Context changes the reading";
document.getElementById("storyBody").textContent =
"The wider reveal shows the second figure and the packed case. What looked like waiting now reads as separation—and the letter becomes part of a departure.";
document.getElementById("omissionText").textContent =
"This is the context view. Return to the original crop to see how selectively the earlier image argued its story.";
document.getElementById("revealButton").textContent = "RETURN TO THE ORIGINAL FRAME";
document.getElementById("revealButton").classList.add("context-active");
document.getElementById("frameName").textContent = "CONTEXT VIEW / WHAT THE FRAME REMOVED";
document.getElementById("frameMood").textContent = "CONTEXT / RELATIONSHIP / DEPARTURE";
return;
}
const shot = shots[state.shot];
if (!shot) {
document.getElementById("storyTitle").textContent = "Your composition";
document.getElementById("storyBody").textContent =
"Move the camera to decide what the photograph emphasizes. A small change in position can convert a person into an object, or remove the person altogether.";
document.getElementById("omissionText").textContent =
"The cue list identifies visual evidence currently outside the crop.";
document.getElementById("revealButton").textContent = "REVEAL OUTSIDE THE FRAME";
document.getElementById("revealButton").classList.remove("context-active");
document.getElementById("frameName").textContent = "CUSTOM FRAME / CAMERA STUDY";
document.getElementById("frameMood").textContent = "CUSTOM / VARIABLE NARRATIVE";
return;
}
document.getElementById("storyTitle").textContent = shot.title;
document.getElementById("storyBody").textContent = `${shot.body} ${shot.lightText[state.light]}`;
document.getElementById("omissionText").textContent = shot.omission;
document.getElementById("revealButton").textContent = "REVEAL OUTSIDE THE FRAME";
document.getElementById("revealButton").classList.remove("context-active");
document.getElementById("frameName").textContent = shot.label;
document.getElementById("frameMood").textContent = shot.mood;
}
function updateShotButtons() {
document.querySelectorAll("[data-shot]").forEach((button) => {
button.classList.toggle("active", button.dataset.shot === state.shot && !state.contextMode);
});
}
function transitionTo(position, target, focalLength, duration = 850) {
cameraTween = {
start: performance.now(),
duration,
fromPosition: camera.position.clone(),
toPosition: position.clone(),
fromTarget: currentTarget.clone(),
toTarget: target.clone(),
fromLens: state.lens,
toLens: focalLength
};
}
function applyShot(name, lensOverride = null, duration = 850) {
const shot = shots[name];
if (!shot) return;
state.contextMode = false;
state.shot = name;
state.lens = lensOverride ?? shot.lens;
document.getElementById("lensRange").value = state.lens;
document.getElementById("lensOutput").textContent = `${Math.round(state.lens)} MM`;
document.getElementById("lensMeta").textContent =
`${Math.round(state.lens)} MM · f/5.6 · 1/60`;
transitionTo(
new THREE.Vector3(...shot.pos),
new THREE.Vector3(...shot.target),
state.lens,
duration
);
updateShotButtons();
updateNarrative();
}
function markCustomFrame() {
if (state.contextMode) return;
state.shot = "custom";
updateShotButtons();
updateNarrative();
}
function setLight(name) {
state.light = name;
document.querySelectorAll("[data-light]").forEach((button) => {
button.classList.toggle("active", button.dataset.light === name);
});
document.getElementById("lightMeta").textContent = lightPresets[name].label;
updateNarrative();
}
function computeExcluded() {
const excluded = [];
for (const item of contextItems) {
const world = item.anchor.getWorldPosition(new THREE.Vector3());
const projected = world.clone().project(camera);
const outside =
projected.z < -1 ||
projected.z > 1 ||
projected.x < -0.98 ||
projected.x > 0.98 ||
projected.y < -0.98 ||
projected.y > 0.98;
if (outside) excluded.push(item);
}
return excluded;
}
function updateContextReadout() {
const excluded = state.contextMode ? state.contextSnapshot : computeExcluded();
const cueList = document.getElementById("cueList");
const badge = document.getElementById("contextBadge");
document.getElementById("cueCount").textContent =
`${String(excluded.length).padStart(2, "0")} FOUND`;
cueList.innerHTML = "";
if (!excluded.length) {
const chip = document.createElement("div");
chip.className = "cue-chip empty";
chip.textContent = "NO MAJOR CUES EXCLUDED";
cueList.appendChild(chip);
} else {
for (const item of excluded) {
const chip = document.createElement("div");
chip.className = "cue-chip";
chip.textContent = item.name;
cueList.appendChild(chip);
}
}
badge.textContent = excluded.length
? `${excluded.length} CUE${excluded.length === 1 ? "" : "S"} OUTSIDE FRAME`
: "FULL CONTEXT IN FRAME";
badge.classList.toggle("full", !excluded.length);
}
function revealContext() {
if (!state.contextMode) {
state.savedFrame = {
shot: state.shot,
lens: state.lens,
position: camera.position.clone(),
target: currentTarget.clone()
};
state.contextSnapshot = computeExcluded();
state.contextMode = true;
for (const item of contextItems) {
item.helper.visible = state.contextSnapshot.includes(item);
item.label.style.display = state.contextSnapshot.includes(item) ? "block" : "none";
}
transitionTo(
new THREE.Vector3(10.8, 8.2, 13.4),
new THREE.Vector3(0.35, 1.45, -1.35),
40,
950
);
updateNarrative();
updateShotButtons();
} else {
const saved = state.savedFrame;
state.contextMode = false;
for (const item of contextItems) {
item.helper.visible = false;
item.label.style.display = "none";
}
if (saved && shots[saved.shot]) {
applyShot(saved.shot, saved.lens, 950);
} else if (saved) {
state.shot = "custom";
state.lens = saved.lens;
setLens(saved.lens);
transitionTo(saved.position, saved.target, saved.lens, 950);
updateShotButtons();
updateNarrative();
}
}
}
function fitFrame() {
const availableWidth = Math.max(180, stage.clientWidth - 62);
const availableHeight = Math.max(220, stage.clientHeight - 112);
let width = availableWidth;
let height = width / state.aspect;
if (height > availableHeight) {
height = availableHeight;
width = height * state.aspect;
}
frameShell.style.width = `${Math.floor(width)}px`;
frameShell.style.height = `${Math.floor(height)}px`;
}
function resizeRenderer() {
const width = Math.max(1, frameShell.clientWidth);
const height = Math.max(1, frameShell.clientHeight);
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.updateProjectionMatrix();
}
// Direct camera controls, implemented without addons.
renderer.domElement.addEventListener("pointerdown", (event) => {
pointerDown = true;
pointerMoved = false;
lastPointer = { x: event.clientX, y: event.clientY };
cameraTween = null;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointerDown) return;
const dx = event.clientX - lastPointer.x;
const dy = event.clientY - lastPointer.y;
if (Math.abs(dx) + Math.abs(dy) > 1) pointerMoved = true;
lastPointer = { x: event.clientX, y: event.clientY };
if (event.shiftKey) {
const radius = camera.position.distanceTo(currentTarget);
const right = new THREE.Vector3().setFromMatrixColumn(camera.matrix, 0);
const up = new THREE.Vector3().setFromMatrixColumn(camera.matrix, 1);
currentTarget.addScaledVector(right, -dx * radius * 0.0015);
currentTarget.addScaledVector(up, dy * radius * 0.0015);
} else {
const offset = camera.position.clone().sub(currentTarget);
const spherical = new THREE.Spherical().setFromVector3(offset);
spherical.theta -= dx * 0.006;
spherical.phi = THREE.MathUtils.clamp(spherical.phi + dy * 0.005, 0.28, 1.42);
camera.position.copy(currentTarget).add(new THREE.Vector3().setFromSpherical(spherical));
}
markCustomFrame();
});
function endPointer(event) {
pointerDown = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
cameraTween = null;
const offset = camera.position.clone().sub(currentTarget);
const radius = THREE.MathUtils.clamp(
offset.length() * Math.exp(event.deltaY * 0.001),
2.8,
27
);
const spherical = new THREE.Spherical().setFromVector3(offset);
spherical.radius = radius;
camera.position.copy(currentTarget).add(new THREE.Vector3().setFromSpherical(spherical));
markCustomFrame();
}, { passive: false });
document.querySelectorAll("[data-shot]").forEach((button) => {
button.addEventListener("click", () => {
state.contextMode = false;
for (const item of contextItems) {
item.helper.visible = false;
item.label.style.display = "none";
}
applyShot(button.dataset.shot);
});
});
document.querySelectorAll("[data-light]").forEach((button) => {
button.addEventListener("click", () => setLight(button.dataset.light));
});
document.querySelectorAll("[data-aspect]").forEach((button) => {
button.addEventListener("click", () => {
state.aspect = Number(button.dataset.aspect);
document.querySelectorAll("[data-aspect]").forEach((b) => {
b.classList.toggle("active", b === button);
});
document.getElementById("aspectOutput").textContent =
state.aspect === 1 ? "1 : 1" : state.aspect === 1.5 ? "3 : 2" : "16 : 9";
document.documentElement.style.setProperty("--ratio", state.aspect);
fitFrame();
resizeRenderer();
});
});
document.getElementById("lensRange").addEventListener("input", (event) => {
cameraTween = null;
setLens(event.target.value);
});
document.getElementById("exposureRange").addEventListener("input", (event) => {
state.exposure = Number(event.target.value);
document.getElementById("exposureOutput").textContent =
`${state.exposure >= 0 ? "+" : ""}${state.exposure.toFixed(1)} EV`;
});
document.getElementById("gridToggle").addEventListener("change", (event) => {
frameShell.classList.toggle("grid-on", event.target.checked);
});
document.getElementById("revealButton").addEventListener("click", revealContext);
document.getElementById("downloadButton").addEventListener("click", () => {
renderer.render(scene, camera);
const link = document.createElement("a");
link.download = `frame-study-${state.shot}.png`;
link.href = renderer.domElement.toDataURL("image/png");
link.click();
});
window.addEventListener("keydown", (event) => {
if (["INPUT", "TEXTAREA", "SELECT"].includes(document.activeElement?.tagName)) return;
const keys = {
"1": "letter",
"2": "medium",
"3": "wide",
"4": "cups",
"5": "door"
};
if (keys[event.key]) {
state.contextMode = false;
for (const item of contextItems) {
item.helper.visible = false;
item.label.style.display = "none";
}
applyShot(keys[event.key]);
}
if (event.key.toLowerCase() === "l") {
const names = ["day", "lamp", "flash"];
const next = names[(names.indexOf(state.light) + 1) % names.length];
setLight(next);
}
if (event.key.toLowerCase() === "r") {
revealContext();
}
});
window.addEventListener("resize", () => {
fitFrame();
resizeRenderer();
});
if ("ResizeObserver" in window) {
new ResizeObserver(resizeRenderer).observe(frameShell);
}
function updateLabels() {
const width = frameShell.clientWidth;
const height = frameShell.clientHeight;
for (const item of contextItems) {
if (!state.contextMode || !state.contextSnapshot.includes(item)) {
item.label.style.display = "none";
continue;
}
const world = item.anchor.getWorldPosition(new THREE.Vector3());
const projected = world.project(camera);
const x = THREE.MathUtils.clamp((projected.x * 0.5 + 0.5) * width, 62, width - 62);
const y = THREE.MathUtils.clamp((-projected.y * 0.5 + 0.5) * height, 40, height - 35);
item.label.style.display = "block";
item.label.style.left = `${x}px`;
item.label.style.top = `${y}px`;
item.helper.visible = true;
item.helper.update();
}
}
const clockTimer = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clockTimer.getDelta(), 0.05);
const now = performance.now();
if (cameraTween) {
const t = THREE.MathUtils.clamp(
(now - cameraTween.start) / cameraTween.duration,
0,
1
);
const eased = t < 0.5
? 4 * t * t * t
: 1 - Math.pow(-2 * t + 2, 3) / 2;
camera.position.lerpVectors(
cameraTween.fromPosition,
cameraTween.toPosition,
eased
);
currentTarget.lerpVectors(
cameraTween.fromTarget,
cameraTween.toTarget,
eased
);
state.lens = THREE.MathUtils.lerp(
cameraTween.fromLens,
cameraTween.toLens,
eased
);
setLens(state.lens);
if (t >= 1) cameraTween = null;
}
const preset = lightPresets[state.light];
const damping = 1 - Math.exp(-dt * 5.5);
lightState.hemi = THREE.MathUtils.lerp(lightState.hemi, preset.hemi, damping);
lightState.key = THREE.MathUtils.lerp(lightState.key, preset.key, damping);
lightState.lamp = THREE.MathUtils.lerp(lightState.lamp, preset.lamp, damping);
lightState.flash = THREE.MathUtils.lerp(lightState.flash, preset.flash, damping);
lightState.exposure = THREE.MathUtils.lerp(lightState.exposure, preset.exposure, damping);
lightState.keyColor.lerp(new THREE.Color(preset.keyColor), damping);
lightState.hemiColor.lerp(new THREE.Color(preset.hemiColor), damping);
lightState.groundColor.lerp(new THREE.Color(preset.groundColor), damping);
hemiLight.intensity = lightState.hemi;
hemiLight.color.copy(lightState.hemiColor);
hemiLight.groundColor.copy(lightState.groundColor);
keyLight.intensity = lightState.key;
keyLight.color.copy(lightState.keyColor);
lampLight.intensity = lightState.lamp;
flashLight.intensity = lightState.flash;
flashLight.position.copy(camera.position).add(new THREE.Vector3(0, 1.5, 0));
flashLight.target.position.copy(currentTarget);
renderer.toneMappingExposure = lightState.exposure * Math.pow(2, state.exposure);
windowMaterial.emissiveIntensity =
state.light === "day" ? 0.72 : state.light === "lamp" ? 0.2 : 0.28;
lampShadeMaterial.emissiveIntensity = 0.12 + lightState.lamp * 0.025;
camera.lookAt(currentTarget);
updateLabels();
if (now - lastContextUpdate > 140) {
updateContextReadout();
lastContextUpdate = now;
}
renderer.render(scene, camera);
}
fitFrame();
resizeRenderer();
setLens(shots.medium.lens);
camera.position.set(...shots.medium.pos);
currentTarget.set(...shots.medium.target);
camera.lookAt(currentTarget);
updateNarrative();
updateContextReadout();
animate();
</script>
</body>
</html>
```