Site: buildings lift on hover and focus, sink on press; ordered keyboard links

This commit is contained in:
ZacharyZhang-NY committed 2026-10-08 23:40:54 -04:00
1 parent 366f7529ba
commit 0f62a36182
5 files changed
+138 -8

No files matched your search

+15 -7
View File
@@ -2,6 +2,7 @@ import "./style.css";
import "./iso.css";
import { block, stage } from "./iso.ts";
import { model } from "./model.ts";
import { touch } from "./touch.ts";
/** 112 BPM, the film's tempo; blocks land on sixteenths. */
const BEAT = 60 / 112;
@@ -10,21 +11,28 @@ const STEP = BEAT / 4;
const app = document.querySelector<HTMLElement>("#app");
if (!app) throw new Error("index.html has no #app");
const apps = model.slice(1, -1);
const parts = new Map<string, SVGGElement[]>();
const blocks: SVGGElement[] = [];
let beat = 1;
for (const part of model) {
part.blocks.forEach((spec, i) => {
const own = part.blocks.map((spec, i) => {
const g = block(spec);
g.style.setProperty("--land", `${(beat * BEAT + i * STEP).toFixed(3)}s`);
blocks.push(g);
return g;
});
if (apps.includes(part)) parts.set(part.name, own);
blocks.push(...own);
beat += Math.ceil(part.blocks.length / 4);
}
const title = document.createElement("h1");
title.textContent = "Ely Office";
const model3d = stage(blocks);
model3d.classList.add("grow");
model3d.setAttribute("role", "img");
model3d.setAttribute("aria-label", model.slice(1, -1).map((p) => p.name).join(", "));
app.append(title, model3d);
const host = document.createElement("div");
host.className = "model";
const svg = stage(blocks);
svg.classList.add("grow");
svg.setAttribute("aria-hidden", "true");
host.append(svg);
app.append(title, host);
touch(host, parts);