The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Home: Live edit next to the reel, a Genjutsu tile, Colorize off the first screen
Adarshdc5a37d91638
diff --git a/public/previews/home/ba-after-1280.avif b/public/previews/home/ba-after-1280.avifdeleted file mode 100644index 0d733fb3..00000000Binary files a/public/previews/home/ba-after-1280.avif and /dev/null differdiff --git a/public/previews/home/ba-after-640.avif b/public/previews/home/ba-after-640.avifdeleted file mode 100644index 02399566..00000000Binary files a/public/previews/home/ba-after-640.avif and /dev/null differdiff --git a/public/previews/home/ba-after-960.avif b/public/previews/home/ba-after-960.avifdeleted file mode 100644index 1716a374..00000000Binary files a/public/previews/home/ba-after-960.avif and /dev/null differdiff --git a/public/previews/home/ba-after-tall-432.avif b/public/previews/home/ba-after-tall-432.avifdeleted file mode 100644index fbc97620..00000000Binary files a/public/previews/home/ba-after-tall-432.avif and /dev/null differdiff --git a/public/previews/home/ba-after-tall-691.avif b/public/previews/home/ba-after-tall-691.avifdeleted file mode 100644index d2b3df26..00000000Binary files a/public/previews/home/ba-after-tall-691.avif and /dev/null differdiff --git a/public/previews/home/ba-before-1280.avif b/public/previews/home/ba-before-1280.avifdeleted file mode 100644index 95d72761..00000000Binary files a/public/previews/home/ba-before-1280.avif and /dev/null differdiff --git a/public/previews/home/ba-before-640.avif b/public/previews/home/ba-before-640.avifdeleted file mode 100644index 80b71132..00000000Binary files a/public/previews/home/ba-before-640.avif and /dev/null differdiff --git a/public/previews/home/ba-before-960.avif b/public/previews/home/ba-before-960.avifdeleted file mode 100644index 09a9d198..00000000Binary files a/public/previews/home/ba-before-960.avif and /dev/null differdiff --git a/public/previews/home/ba-before-tall-432.avif b/public/previews/home/ba-before-tall-432.avifdeleted file mode 100644index 4b35e921..00000000Binary files a/public/previews/home/ba-before-tall-432.avif and /dev/null differdiff --git a/public/previews/home/ba-before-tall-691.avif b/public/previews/home/ba-before-tall-691.avifdeleted file mode 100644index 1f67db46..00000000Binary files a/public/previews/home/ba-before-tall-691.avif and /dev/null differdiff --git a/public/previews/home/genjutsu-1024.avif b/public/previews/home/genjutsu-1024.avifnew file mode 100644index 00000000..98de391cBinary files /dev/null and b/public/previews/home/genjutsu-1024.avif differdiff --git a/public/previews/home/genjutsu-1024.jpg b/public/previews/home/genjutsu-1024.jpgnew file mode 100644index 00000000..37c32ee2Binary files /dev/null and b/public/previews/home/genjutsu-1024.jpg differdiff --git a/public/previews/home/genjutsu-1024.mp4 b/public/previews/home/genjutsu-1024.mp4new file mode 100644index 00000000..4f4d3b37Binary files /dev/null and b/public/previews/home/genjutsu-1024.mp4 differdiff --git a/public/previews/home/genjutsu-640.avif b/public/previews/home/genjutsu-640.avifnew file mode 100644index 00000000..bc9d2cd8Binary files /dev/null and b/public/previews/home/genjutsu-640.avif differdiff --git a/public/previews/home/genjutsu-640.mp4 b/public/previews/home/genjutsu-640.mp4new file mode 100644index 00000000..165bdd31Binary files /dev/null and b/public/previews/home/genjutsu-640.mp4 differdiff --git a/public/previews/home/genjutsu-original-240.avif b/public/previews/home/genjutsu-original-240.avifnew file mode 100644index 00000000..786bb527Binary files /dev/null and b/public/previews/home/genjutsu-original-240.avif differdiff --git a/public/previews/home/genjutsu-original-480.avif b/public/previews/home/genjutsu-original-480.avifnew file mode 100644index 00000000..59ecb148Binary files /dev/null and b/public/previews/home/genjutsu-original-480.avif differdiff --git a/scripts/gen-home-bento.mjs b/scripts/gen-home-bento.mjsindex e17cfad5..85be8d0f 100644--- a/scripts/gen-home-bento.mjs+++ b/scripts/gen-home-bento.mjs@@ -13,8 +13,9 @@* rotation-{640,1024,1536,2048}.{mp4,avif} the turning gown (the 3D tile) at four widths, and each one's first frame* reel-sand-storm-1024.jpg, rotation-1024.jpg the 1024 px clips' first frames, for a browser without AVIF* image-4-{480,768}.avif the Image studio's example 4- * ba-{before,after}-{640,960,1280}.avif Colorize's before and after (4:3)- * ba-{before,after}-tall-{432,691}.avif the same pair, a 3:5 crop for the tall tile+ * genjutsu-{640,1024}.{mp4,avif} Genjutsu's group swap (the Genjutsu tile) at two widths, and each one's first frame+ * genjutsu-1024.jpg the 1024 px clip's first frame, for a browser without AVIF+ * genjutsu-original-{240,480}.avif the original clip's first frame, for the Genjutsu tile's window* board-{photo,film}.webp the Canvas board's photo and a frame of its film, 168 px squares* and src/lib/home-bento.generated.ts: each file's content version, the reel (its clips in order, each one's length and* framing, and where set how long it holds its last frame and fades out), each poster's mean colour, and the waveform.@@ -37,7 +38,7 @@* <dir>/<preset>-2048.mkv the same render upscaled to 2048 x 1536, every frame (SeedVR2 7B, lossless FFV1,* BT.709), for the 1536 and 2048 px copies: the 3D clip needs it; a reel clip without* one comes at 640 and 1024 only- * <dir>/app-colorize-before.png, <dir>/app-colorize-after.png Colorize's pair at full size (1536 x 1152)+ * <dir>/genjutsu-group-swap.mp4 Genjutsu's group swap at full size (1024 x 768, 24 fps): the Genjutsu tile's clip* Without it those files are kept as they are (and versioned; a reel clip in the widths it has), the posters are made* again from the clips kept, and so is the rest.*@@ -69,14 +70,6 @@ export const WAVE_BARS = 48;export const WAVE_FLOOR = 0.12;const WAVE_SOURCE = "/samples/clean-voice/clean.m4a";-/** The app the before/after tile shows (BENTO_BEFORE_AFTER in src/lib/home-bento.ts). */-const BA_APP = "app-colorize";-/**- * The before/after tile is wide on a phone and a tablet (the 4:3 pair) and tall from lg: there it takes a 3:5 crop of- * the full-size pair (1536 x 1152) around the subject, so it is never stretched past its own pixels and her face stays- * in the frame.- */-const BA_TALL = { left: 422, top: 0, width: 691, height: 1152 };/*** The video tile's reel, in the order it plays: each clip's preset, the name of its copies here, the stretch of its* render it plays (`from`, its first frame; `frames`, at CLIP_FPS), where the tile anchors it (its object-position:@@ -96,6 +89,12 @@ export const REEL = [* wider copies, made from the 2048 px master, at a higher CRF: their pixels are smaller on the screen).*/const LOOPS = [{ key: "app-3d-rotation", name: "rotation", crf: { 640: 23, 1024: 23, 1536: 27, 2048: 28 } }];+/**+ * The Genjutsu tile's clip (BENTO_GENJUTSU in src/lib/home-bento.ts): `frames` frames of its render from frame `from`,+ * played on a loop as they are (a crossfade at the seam would lay one face over another), at the widths its 1024 px+ * render covers, and the CRF each is encoded at.+ */+export const CUTS = [{ key: "genjutsu-group-swap", name: "genjutsu", from: 0, frames: 120, widths: [640, 1024], crf: { 640: 22, 1024: 23 } }];/** The widths each clip and its poster are made at: a tile takes the first at least as wide as its box needs. */const CLIP_WIDTHS = [640, 1024, 1536, 2048];/** The widths a reel clip is made at from its render alone (wider ones need its 2048 px master). */@@ -113,12 +112,10 @@ const BOARD_THUMBS = [const STILLS = [{ name: "image-4-480.avif", from: "/examples/image/4/out.jpg", width: 480 },{ name: "image-4-768.avif", from: "/examples/image/4/out.jpg", width: 768 },+ // The original clip's first frame (GENJUTSU_ORIGINAL in src/lib/home-bento.ts), for the Genjutsu tile's window.+ { name: "genjutsu-original-240.avif", from: "/examples/genjutsu-character/1/in-clip.jpg", width: 240 },+ { name: "genjutsu-original-480.avif", from: "/examples/genjutsu-character/1/in-clip.jpg", width: 480 },];-/** Copies made from a master (`master`: its file name in the masters folder). */-const MASTER_STILLS = ["before", "after"].flatMap((side) => [- ...[640, 960, 1280].map((width) => ({ name: `ba-${side}-${width}.avif`, master: `${BA_APP}-${side}.png`, width })),- ...[432, 691].map((width) => ({ name: `ba-${side}-tall-${width}.avif`, master: `${BA_APP}-${side}.png`, width, crop: BA_TALL })),-]);/** AVIF quality: the copies sit under a dark shade, and each tile takes one at least as wide as it shows. */const QUALITY = 55;/** The clips' posters: close enough to the clip's own first frame that the swap from one to the other can't be seen. */@@ -235,13 +232,13 @@ async function main() {make: () => encodeClipBuffer(loopAt(master(w >= HD_FROM ? `${c.key}-2048.mkv` : `${c.key}.mp4`), w).all, c.crf[w]),})),),- ...MASTER_STILLS.map((s) => ({- ...s,- make: () => {- const img = sharp(master(s.master));- return (s.crop ? img.extract(s.crop) : img).resize(s.width).avif({ quality: QUALITY, effort: 6 }).toBuffer();- },- })),+ ...CUTS.flatMap((c) =>+ c.widths.map((w) => ({+ name: `${c.name}-${w}.mp4`,+ clip: true,+ make: () => encodeClipBuffer(cutAt(master(`${c.key}.mp4`), w, c.from, c.frames), c.crf[w]),+ })),+ ),];for (const s of fromMasters) {const out = path.join(OUT_DIR, s.name);@@ -257,8 +254,8 @@ async function main() {}if (!DRY) versions[`/previews/home/${s.name}`] = contentVersion([out]);}- // Each poster, from its clip as it is now (just made, or kept): the reel's first clip's, and the 3D clip's.- const posterSets = [{ name: reel[0].name, widths: reel[0].widths }, ...LOOPS.map((c) => ({ name: c.name, widths: CLIP_WIDTHS }))];+ // Each poster, from its clip as it is now (just made, or kept): the reel's first clip's, the 3D clip's and Genjutsu's.+ const posterSets = [{ name: reel[0].name, widths: reel[0].widths }, ...LOOPS.map((c) => ({ name: c.name, widths: CLIP_WIDTHS })), ...CUTS.map((c) => ({ name: c.name, widths: c.widths }))];const posters = posterSets.flatMap((c) => c.widths.map((w) => ({ name: `${c.name}-${w}.avif`, clip: `${c.name}-${w}.mp4` })));const jobs = [...posters.map((p) => ({diff --git a/src/app/(studio)/page.tsx b/src/app/(studio)/page.tsxindex 516144d9..0999019f 100644--- a/src/app/(studio)/page.tsx+++ b/src/app/(studio)/page.tsx@@ -47,10 +47,11 @@ export default async function Page() {prices={starterPriceLine()}quotes={startQuotes()}>+ {/* Live edit is the highlight: its own section comes first, right under the first screen and the composer. */}+ <LiveEditSection /><EffectsSection facts={home.facts} effects={home.effects} /><MotionsSection facts={home.facts} motions={home.motions} /><AppsSection facts={home.facts} beforeAfter={home.beforeAfter} reveals={home.reveals} />- <LiveEditSection /><StudiosSection facts={home.facts} studios={home.studios} audioTools={home.audioTools} pills={home.pills} /><AssistSection facts={home.facts} skills={home.skills} /><OpenSourceSection facts={home.facts} newModels={home.newModels} />diff --git a/src/components/home/bento-islands.tsx b/src/components/home/bento-islands.tsxindex 94d2f787..21df8f18 100644--- a/src/components/home/bento-islands.tsx+++ b/src/components/home/bento-islands.tsx@@ -232,7 +232,9 @@ export function BentoClip({ id, clips, progress }: { id: string; clips: Sized[];return (<span ref={ref} aria-hidden className={s.clip} onPointerEnter={handlers.onPointerEnter} onPointerLeave={handlers.onPointerLeave}>- {clip && <video ref={video} src={clip} muted loop playsInline preload="auto" data-ready={ready || undefined} onLoadedData={() => setReady(true)} />}+ {clip && (+ <video ref={video} src={clip} muted loop playsInline preload="auto" data-max={Math.max(...clips.map((c) => c.w))} data-ready={ready || undefined} onLoadedData={() => setReady(true)} />+ )}{progress && (<span className={s.progress}><i ref={bar} />diff --git a/src/components/home/home-bento-classes.ts b/src/components/home/home-bento-classes.tsindex dd642a9e..61dc5dfd 100644--- a/src/components/home/home-bento-classes.ts+++ b/src/components/home/home-bento-classes.ts@@ -3,6 +3,6 @@* stylesheet in this app is (next.config.ts runs each .css file through Tailwind as plain CSS), so the prefix keeps its* names to itself.*/-const NAMES = ["accent","aside","audio","badge","before","bento","big","board","box","canvas","caret","clip","copy","corner","cta","edges","end","figures","fill","filmMark","foot","frame","grid","h1","head","image","kenburns","l2b","left","line1","line2","live","meta","node","nodeLabel","numbers","numbersFoot","numbersLine","out","pic","pill","playhead","progress","restore","right","shade","side","split","step","three","tile","title","tsx","typed","video","wave"] as const;+const NAMES = ["accent","aside","audio","badge","bento","big","board","box","canvas","caret","clip","copy","corner","cta","edges","end","figures","fill","filmMark","foot","frame","genjutsu","grid","h1","head","image","kenburns","l2b","line1","line2","live","meta","node","nodeLabel","numbers","numbersFoot","numbersLine","original","originalLabel","out","pic","pill","playhead","progress","shade","step","three","tile","title","tsx","typed","video","wave"] as const;export const s = Object.fromEntries(NAMES.map((n) => [n, `hb-${n.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase())}`])) as Record<(typeof NAMES)[number], string>;diff --git a/src/components/home/home-bento.css b/src/components/home/home-bento.cssindex 6c3e76e6..2104a4af 100644--- a/src/components/home/home-bento.css+++ b/src/components/home/home-bento.css@@ -224,15 +224,21 @@/* ---------------------------------------------------------------- grid */+/*+ * The reel leads; Live edit, the highlight, is the next biggest and sits right by it (right under it on a phone), and+ * Genjutsu comes next. From lg the grid is twelve narrow columns, so the top two rows (the reel, Live edit, then the+ * image and 3D tiles stacked) and the bottom row (Genjutsu, audio, the numbers, canvas) each split it their own way.+ */.hb-grid {display: grid;gap: var(--bento-gap);grid-template-columns: repeat(2, minmax(0, 1fr));grid-template-areas:"video video"+ "live live"+ "genjutsu genjutsu""image three"- "restore restore"- "live audio"+ "audio audio""canvas canvas""numbers numbers";}@@ -240,14 +246,19 @@.hb-video {aspect-ratio: 3 / 2;}+ /* Wide enough to show the whole portrait, short enough that the reel and it fit a phone's first screen. */+ .hb-live {+ aspect-ratio: 16 / 10;+ }+ .hb-genjutsu {+ aspect-ratio: 3 / 2;+ }.hb-image,- .hb-three,- .hb-live,- .hb-audio {+ .hb-three {aspect-ratio: 1;}- .hb-restore {- aspect-ratio: 2 / 1;+ .hb-audio {+ aspect-ratio: 5 / 2;}.hb-canvas {aspect-ratio: 16 / 9;@@ -258,22 +269,22 @@grid-template-columns: repeat(3, minmax(0, 1fr));grid-template-rows: repeat(4, 210px) auto;grid-template-areas:- "video video image"- "video video three"- "restore restore audio"- "live canvas canvas"+ "video video live"+ "video video live"+ "genjutsu genjutsu image"+ "audio canvas three""numbers numbers numbers";}}@media (min-width: 1024px) {.hb-grid {- grid-template-columns: repeat(4, minmax(0, 1fr));+ grid-template-columns: repeat(12, minmax(0, 1fr));grid-template-rows: repeat(3, minmax(0, 1fr));height: clamp(var(--grid-min), calc(var(--content-h) - var(--bento-head) - var(--head-top) - 3.25rem), 760px);grid-template-areas:- "video video image audio"- "video video three restore"- "numbers live canvas restore";+ "video video video video video video live live live live image image"+ "video video video video video video live live live live three three"+ "genjutsu genjutsu genjutsu genjutsu audio audio numbers numbers numbers canvas canvas canvas";}}.hb-video {@@ -288,8 +299,8 @@.hb-three {grid-area: three;}-.hb-restore {- grid-area: restore;+.hb-genjutsu {+ grid-area: genjutsu;}.hb-numbers {grid-area: numbers;@@ -474,6 +485,14 @@font-size: 44px;}}+/* From lg the live tile is the second biggest: its title a size up from the small tiles'. */+@media (min-width: 1024px) {+ @container (min-width: 360px) {+ .hb-live .hb-title {+ font-size: 34px;+ }+ }+}/** From lg every tile's box is fixed by the grid, so a tile can be measured both ways: a short one (1024 x 768) drops@@ -678,93 +697,53 @@height: 45%;}-/* ---------------------------------------------------------------- restore: a split that sweeps */+/* ---------------------------------------------------------------- genjutsu: the swap, and the clip as it was */-.hb-before {- clip-path: inset(0 50% 0 0);+/* The couple's faces sit in the top half of the clip (from 16 % to 43 % of its height in every frame): a wide, short+ tile keeps them in view. */+.hb-genjutsu > .hb-pic .hb-fill,+.hb-genjutsu .hb-clip video {+ object-position: 50% 22%;}-/* The line moves by transform, across the tile's own width (cqw: the tile is a container), so it never lays out again. */-.hb-split {+/*+ * The original clip's first frame, in a small window in the tile's top corner: what went in, beside what came out. On+ * a layer over the clip and the shade, its size from the tile's own width (the tile is a container), so it never lays+ * out again.+ */+.hb-original {position: absolute;- top: 0;- bottom: 0;- left: 0;- transform: translateX(50cqw);- width: 2px;- margin-left: -1px;- background: #fff;- box-shadow: 0 0 10px rgb(0 0 0 / 50%);+ z-index: 1;+ top: 10px;+ right: 10px;+ width: clamp(76px, 27cqw, 132px);+ aspect-ratio: 4 / 3;+ overflow: hidden;+ border-radius: 8px;+ border: 1px solid rgb(255 255 255 / 55%);+ background: #222228;+ box-shadow: 0 6px 18px rgb(0 0 0 / 40%);pointer-events: none;}-.hb-split > span {- position: absolute;- top: 40%;- left: 50%;- display: grid;- place-items: center;- width: 30px;- height: 30px;- margin: -15px 0 0 -15px;- border-radius: 999px;- background: #fff;- color: #0d0d0f;-}-.hb-bento[data-play] .hb-before {- animation: bento-wipe 9s ease-in-out infinite;- animation-play-state: paused;-}-.hb-bento[data-play] .hb-split {- animation: bento-split 9s ease-in-out infinite;- animation-play-state: paused;-}-.hb-bento[data-play="1"] .hb-before,-.hb-bento[data-play="1"] .hb-split {- animation-play-state: running;-}-@keyframes bento-wipe {- 0%,- 100% {- clip-path: inset(0 50% 0 0);- }- 25% {- clip-path: inset(0 28% 0 0);- }- 75% {- clip-path: inset(0 72% 0 0);- }-}-@keyframes bento-split {- 0%,- 100% {- transform: translateX(50cqw);- }- 25% {- transform: translateX(72cqw);- }- 75% {- transform: translateX(28cqw);- }-}-.hb-side {+.hb-original-label {position: absolute;- top: 12px;- height: 24px;+ left: 5px;+ bottom: 5px;+ height: 16px;display: inline-flex;align-items: center;- padding: 0 9px;+ padding: 0 6px;border-radius: 999px;background: rgb(13 13 15 / 78%);- font-size: 10.5px;+ font-size: 9.5px;font-weight: 500;letter-spacing: 0.08em;text-transform: uppercase;- pointer-events: none;-}-.hb-side.hb-left {- left: 12px;}-.hb-side.hb-right {- right: 12px;+@container (min-width: 300px) {+ .hb-original {+ top: 12px;+ right: 12px;+ }}/* The reel's clips and its still: a wide, short tile crops from the bottom, so the head always shows (a clip framedotherwise sets its own object-position: HOME_BENTO_REEL). */@@ -772,15 +751,6 @@.hb-video .hb-clip video {object-position: 50% 0%;}-/* The pair's framing: a phone's and a tablet's wide tile keeps her face in its upper half; from lg the tall crop is centred on her. */-.hb-restore .hb-fill {- object-position: 50% 12%;-}-@media (min-width: 1024px) {- .hb-restore .hb-fill {- object-position: 50% 30%;- }-}/* ---------------------------------------------------------------- numbers */@@ -915,6 +885,22 @@font-size: 12.5px;pointer-events: none;}+/* The live tile is the first screen's highlight: on its big tile the field is a size up. */+@container (min-width: 340px) {+ .hb-pill {+ top: 16px;+ left: 16px;+ max-width: calc(100% - 32px);+ min-width: min(calc(100% - 32px), 190px);+ height: 38px;+ padding: 0 14px;+ gap: 8px;+ font-size: 14px;+ }+ .hb-caret {+ height: 17px;+ }+}.hb-pill > svg {flex: none;color: var(--bento-accent);@@ -1122,8 +1108,6 @@.hb-bento .hb-kenburns,.hb-bento .hb-wave > i,.hb-bento .hb-playhead,- .hb-bento .hb-before,- .hb-bento .hb-split,.hb-bento .hb-caret,.hb-bento .hb-edges path {animation: none !important;diff --git a/src/components/home/home-bento.tsx b/src/components/home/home-bento.tsxindex 656e8f67..405fc235 100644--- a/src/components/home/home-bento.tsx+++ b/src/components/home/home-bento.tsx@@ -1,4 +1,4 @@-import { ArrowRight, ArrowUpRight, ChevronsLeftRight, Play, Sparkles, Video } from "lucide-react";+import { ArrowRight, ArrowUpRight, Play, Sparkles, Video } from "lucide-react";import { preload } from "react-dom";import { BentoClip, BentoMotion, BentoReel, LiveTyping, NumbersLink } from "@/components/home/bento-islands";import { PausePreviews } from "@/components/home/home-islands";@@ -15,20 +15,23 @@ import "./home-bento.css";*/const SIZES = {video: "(min-width: 1024px) 572px, (min-width: 768px) 576px, calc(100vw - 32px)",+ /**+ * The live tile: from lg a third of the grid wide and two rows tall (up to 570 px under cover on a 1920 x 1080+ * screen), two rows tall on a tablet, the full row on a phone.+ */+ live: "(min-width: 1024px) 570px, (min-width: 768px) 580px, calc(100vw - 32px)",/** A 4:3 picture in a square tile on a phone (half the row): cropped at its sides, so 4/3 of the tile's width. */- square: "(min-width: 1024px) 290px, (min-width: 768px) 280px, calc((100vw - 44px) * 0.667)",- /** The before/after tile: wide (its 4:3 pair) below lg; from lg it is tall and takes the pair's 3:5 crop (`tall`). */- wide: "(min-width: 768px) 476px, calc(100vw - 32px)",- tall: "290px",+ square: "(min-width: 1024px) 274px, (min-width: 768px) 320px, calc((100vw - 44px) * 0.667)",+ /** The Genjutsu tile: a third of the grid wide from lg, two columns on a tablet, the full row on a phone. */+ genjutsu: "(min-width: 1024px) 376px, (min-width: 768px) 476px, calc(100vw - 32px)",+ /** The original's window in the Genjutsu tile (home-bento.css: at most 132 px wide). */+ original: "132px",};-/** From lg the before/after tile is tall (home-bento.css). */-const TALL_MEDIA = "(min-width: 1024px)";/**- * A picture in AVIF where the browser takes it, its published JPEG or WebP where not; a picture with a `tall` crop- * takes it from lg. `position`: its object-position, where it differs from its tile's. Its tint (a clip's poster) is- * its box's colour until it is in. `decoding`: "sync" for the picture that must land with the first screen.- * Decorative: the tile's link names it.+ * A picture in AVIF where the browser takes it, its published JPEG or WebP where not. `position`: its object-position,+ * where it differs from its tile's. Its tint (a clip's poster) is its box's colour until it is in. `decoding`: "sync"+ * for the picture that must land with the first screen. Decorative: the tile's link names it.*/function Pic({pic,@@ -49,7 +52,6 @@ function Pic({}) {return (<picture className={s.pic}>- {pic.tall && <source media={TALL_MEDIA} type="image/avif" srcSet={pic.tall.map((a) => `${a.src} ${a.w}w`).join(", ")} sizes={SIZES.tall} />}<source type="image/avif" srcSet={pic.avif.map((a) => `${a.src} ${a.w}w`).join(", ")} sizes={sizes} /><imgsrc={pic.fallback}@@ -189,7 +191,7 @@ export function HomeBento({ bento }: { bento: Bento }) {<span aria-hidden className={s.end} /></span></h1>- <p className={s.aside}>Film, stills, sound, 3D, live edits and whole pipelines. Each tile opens the studio that makes it.</p>+ <p className={s.aside}>Film, live edits, swaps, stills, sound, 3D and whole pipelines. Each tile opens the studio that makes it.</p></div><div className={s.grid}>@@ -201,17 +203,12 @@ export function HomeBento({ bento }: { bento: Bento }) {</span></Tile>- <Tile tile={tiles.image} area={s.image}>- <Pic pic={bento.image} sizes={SIZES.square} className={s.kenburns} fetchPriority="low" />+ <Tile tile={tiles.live} area={s.live}>+ <LiveTyping frames={bento.live.frames} phrases={bento.live.phrases} sizes={SIZES.live} /></Tile>- <Tile tile={tiles.audio} area={s.audio}>- <span aria-hidden className={s.wave} style={{ "--wave-s": `${bento.wave.seconds}s` } as React.CSSProperties}>- {bento.wave.bars.map((h, i) => (- <i key={i} style={{ "--h": h, "--d": `${((i / bento.wave.bars.length) * bento.wave.seconds).toFixed(3)}s` } as React.CSSProperties} />- ))}- <span className={s.playhead} />- </span>+ <Tile tile={tiles.image} area={s.image}>+ <Pic pic={bento.image} sizes={SIZES.square} className={s.kenburns} fetchPriority="low" /></Tile><Tile tile={tiles.threeD} area={s.three}>@@ -219,19 +216,22 @@ export function HomeBento({ bento }: { bento: Bento }) {<BentoClip id={bento.threeD.id} clips={bento.threeD.clips} /></Tile>- <Tile tile={tiles.restore} area={s.restore}>- <Pic pic={bento.restore.after} sizes={SIZES.wide} fetchPriority="low" />- <Pic pic={bento.restore.before} sizes={SIZES.wide} className={s.before} fetchPriority="low" />- <span aria-hidden className={s.split}>- <span>- <ChevronsLeftRight className="size-4" />- </span>+ <Tile tile={tiles.genjutsu} area={s.genjutsu}>+ <Pic pic={bento.genjutsu.poster} sizes={SIZES.genjutsu} fetchPriority="low" />+ <BentoClip id={bento.genjutsu.id} clips={bento.genjutsu.clips} />+ {/* The clip as it was: both people in it are swapped in the one take behind it. */}+ <span aria-hidden className={s.original}>+ <Pic pic={bento.genjutsu.original} sizes={SIZES.original} fetchPriority="low" />+ <span className={s.originalLabel}>Original</span></span>- <span aria-hidden className={cn(s.side, s.left)}>- Before- </span>- <span aria-hidden className={cn(s.side, s.right)}>- After+ </Tile>++ <Tile tile={tiles.audio} area={s.audio}>+ <span aria-hidden className={s.wave} style={{ "--wave-s": `${bento.wave.seconds}s` } as React.CSSProperties}>+ {bento.wave.bars.map((h, i) => (+ <i key={i} style={{ "--h": h, "--d": `${((i / bento.wave.bars.length) * bento.wave.seconds).toFixed(3)}s` } as React.CSSProperties} />+ ))}+ <span className={s.playhead} /></span></Tile>@@ -254,10 +254,6 @@ export function HomeBento({ bento }: { bento: Bento }) {</span></NumbersLink>- <Tile tile={tiles.live} area={s.live}>- <LiveTyping frames={bento.live.frames} phrases={bento.live.phrases} sizes={SIZES.square} />- </Tile>-<Tile tile={tiles.canvas} area={s.canvas}><CanvasBoard board={bento.canvas} /></Tile>diff --git a/src/lib/home-bento.generated.ts b/src/lib/home-bento.generated.tsindex ea4be0ab..25e9325f 100644--- a/src/lib/home-bento.generated.ts+++ b/src/lib/home-bento.generated.ts@@ -12,26 +12,23 @@ export const HOME_BENTO_MEDIA: Record<string, string> = {"/previews/home/rotation-1024.mp4": "3f5507ab","/previews/home/rotation-1536.mp4": "87d3d4f1","/previews/home/rotation-2048.mp4": "5804eda4",- "/previews/home/ba-before-640.avif": "8adbdbd7",- "/previews/home/ba-before-960.avif": "7f7f2735",- "/previews/home/ba-before-1280.avif": "7b757bc9",- "/previews/home/ba-before-tall-432.avif": "af0e8f74",- "/previews/home/ba-before-tall-691.avif": "aaafef5d",- "/previews/home/ba-after-640.avif": "4ad38a6c",- "/previews/home/ba-after-960.avif": "670dbb52",- "/previews/home/ba-after-1280.avif": "61952772",- "/previews/home/ba-after-tall-432.avif": "71f125b7",- "/previews/home/ba-after-tall-691.avif": "46271396",+ "/previews/home/genjutsu-640.mp4": "17ae2073",+ "/previews/home/genjutsu-1024.mp4": "6611d454","/previews/home/reel-sand-storm-640.avif": "6e339255","/previews/home/reel-sand-storm-1024.avif": "13b5d74a","/previews/home/rotation-640.avif": "c69b0d7b","/previews/home/rotation-1024.avif": "23d2a89b","/previews/home/rotation-1536.avif": "b3df3778","/previews/home/rotation-2048.avif": "bcc9ccc5",+ "/previews/home/genjutsu-640.avif": "78148871",+ "/previews/home/genjutsu-1024.avif": "61b49f42","/previews/home/reel-sand-storm-1024.jpg": "cab53f24","/previews/home/rotation-1024.jpg": "61a2cbc9",+ "/previews/home/genjutsu-1024.jpg": "c69400ea","/previews/home/image-4-480.avif": "5a6d07a1","/previews/home/image-4-768.avif": "ef9d1b4d",+ "/previews/home/genjutsu-original-240.avif": "ecc3f2d0",+ "/previews/home/genjutsu-original-480.avif": "c0db35a8","/previews/home/board-photo.webp": "47432641","/previews/home/board-film.webp": "db007869"};@@ -59,7 +56,8 @@ export const HOME_BENTO_REEL = [/** Each poster's mean colour (by its clip's name): the tile shows it until the poster is in. */export const HOME_BENTO_TINT: Record<string, string> = {"reel-sand-storm": "#b06c4c",- "rotation": "#bfbeb6"+ "rotation": "#bfbeb6",+ "genjutsu": "#796c56"};export const HOME_BENTO_WAVE = {diff --git a/src/lib/home-bento.ts b/src/lib/home-bento.tsindex c46020e6..6ec8e2d2 100644--- a/src/lib/home-bento.ts+++ b/src/lib/home-bento.ts@@ -6,7 +6,7 @@import "server-only";import fs from "node:fs/promises";import path from "node:path";-import { MODELS, getPreset, isListed } from "@/lib/catalog";+import { MODELS, isListed } from "@/lib/catalog";import { getTemplate } from "@/lib/catalog/canvas";import { runsOn } from "@/lib/catalog/engines";import type { ModelDef } from "@/lib/catalog/types";@@ -15,7 +15,6 @@ import { HOME_BENTO_MEDIA, HOME_BENTO_REEL, HOME_BENTO_TINT, HOME_BENTO_WAVE } fimport type { ReelClip } from "@/lib/home-reel";import type { Demo } from "@/lib/live/demo";import { presetCover } from "@/lib/preset-covers";-import { PRESET_BEFORE_AFTER } from "@/lib/preset-before-after.generated";import { templateCover } from "@/lib/template-covers";/** The preset whose clip the 3D tile plays (no other card on Home plays it: tests/home-showcase.test.ts). */@@ -34,8 +33,18 @@ export const BENTO_REEL_ID = "home-reel";export const BENTO_CLIP_FALLBACK = 1024;/** The Image studio's example the image tile shows and opens with (src/lib/examples/plan.json). */export const BENTO_IMAGE_EXAMPLE = { id: "image.4", out: "/examples/image/4/out.jpg" };-/** The app the before/after tile shows and opens: black and white to colour reads at a glance. */-export const BENTO_BEFORE_AFTER = "app-colorize";+/**+ * The Genjutsu tile: Genjutsu's own Group swap example (a couple, both people swapped in one take; the studio's cover+ * "genjutsu-group-swap"), cut by scripts/gen-home-bento.mjs into `name`'s copies, with the original clip's first frame in+ * a small window. Its id in the playback store is its own, so a card lower down can play the same clip.+ */+export const BENTO_GENJUTSU = { id: "home-genjutsu", cover: "genjutsu-group-swap", name: "genjutsu", original: "genjutsu-original" } as const;+/** The widths the Genjutsu clip comes in: its render is 1024 px wide, and nothing is made up past that. */+export const BENTO_GENJUTSU_WIDTHS = [640, 1024] as const;+/** The widths of the original's window (it shows at up to about 130 px wide: 480 covers a 3x screen). */+export const BENTO_ORIGINAL_WIDTHS = [240, 480] as const;+/** The example whose original clip's first frame the window shows (Genjutsu's Character swap example, src/lib/examples). */+export const GENJUTSU_ORIGINAL = "/examples/genjutsu-character/1/in-clip.jpg";/** The Canvas board the canvas tile draws: the same film as /canvas's "What's a canvas?". */export const BENTO_BOARD = "effect-chain-pearl-earring";/** The Live edit steps the live tile plays: the session's first three changes (Home's Live edit section plays them all). */@@ -47,7 +56,7 @@ export const BENTO_HREFS = {image: `/image?example=${BENTO_IMAGE_EXAMPLE.id}`,audio: "/audio",threeD: "/image-to-3d",- restore: `/apps/${BENTO_BEFORE_AFTER}`,+ genjutsu: "/genjutsu",numbers: "#home-studios",live: "/live-edit?from=home",canvas: "/canvas",@@ -56,14 +65,12 @@ export const BENTO_HREFS = {export type BentoKey = keyof typeof BENTO_HREFS;/**- * A picture in two or three widths: AVIF for the browsers that take it, the published JPEG for the rest. `tall`: a portrait- * crop of it for a tile that is tall from lg (home-bento.tsx), so the picture is never stretched past its own pixels.- * `tint`: its mean colour, shown until it is in (a clip's poster).+ * A picture in two or more widths: AVIF for the browsers that take it, the published JPEG for the rest. `tint`: its+ * mean colour, shown until it is in (a clip's poster).*/export interface BentoPicture {avif: { src: string; w: number }[];fallback: string;- tall?: { src: string; w: number }[];tint?: string;}@@ -174,20 +181,13 @@ function board() {/** Everything the first screen shows, computed once per build with the rest of Home (homeShowcase). */export async function homeBento(f: BentoFacts) {const threeD = presetCover(BENTO_CLIPS.threeD);- const restore = getPreset(BENTO_BEFORE_AFTER);- const baV = PRESET_BEFORE_AFTER[BENTO_BEFORE_AFTER];- if (!threeD?.video || !restore || !baV || BENTO_REEL.some((id) => !presetCover(id)?.video)) throw new Error("Home's first screen names a clip or an app without its published media");+ if (!threeD?.video || BENTO_REEL.some((id) => !presetCover(id)?.video)) throw new Error("Home's first screen names a clip without its published media");const demo = await readDemo();const frame = (id: string) => {const fr = demo.frames[id];- if (!fr?.small || !fr.mid || !fr.webp) throw new Error(`Home's live tile names frame ${id}, which the Live edit session doesn't have`);- return { avif: [{ src: fr.small, w: 512 }, { src: fr.mid, w: 768 }], fallback: fr.webp } satisfies BentoPicture;+ if (!fr?.small || !fr.mid || !fr.src || !fr.webp) throw new Error(`Home's live tile names frame ${id}, which the Live edit session doesn't have`);+ return { avif: [{ src: fr.small, w: 512 }, { src: fr.mid, w: 768 }, { src: fr.src, w: 1280 }], fallback: fr.webp } satisfies BentoPicture;};- const restoreSide = (side: "before" | "after"): BentoPicture => ({- avif: [640, 960, 1280].map((w) => ({ src: made(`/previews/home/ba-${side}-${w}.avif`), w })),- tall: [432, 691].map((w) => ({ src: made(`/previews/home/ba-${side}-tall-${w}.avif`), w })),- fallback: `/previews/presets/ba/960/${BENTO_BEFORE_AFTER}-${side}.jpg?v=${baV}`,- });// The video tile's reel: each clip in the widths it comes in, and the first one's first frame as the poster, in its// widths (and a JPEG at 1024 px for a browser without AVIF).const reel = (): BentoReelTile => {@@ -206,20 +206,17 @@ export async function homeBento(f: BentoFacts) {}),};};- // A moving tile: its poster (the clip's first frame) and its clip, each in every width; for a browser without AVIF, the- // 1024 px clip's first frame as a JPEG.- const moving = (key: keyof typeof BENTO_CLIPS): BentoMovingTile => {- const name = BENTO_CLIP_FILES[key];- return {- id: BENTO_CLIPS[key],- poster: {- avif: BENTO_CLIP_WIDTHS.map((w) => ({ src: made(`/previews/home/${name}-${w}.avif`), w })),- fallback: made(`/previews/home/${name}-${BENTO_CLIP_FALLBACK}.jpg`),- tint: HOME_BENTO_TINT[name],- },- clips: BENTO_CLIP_WIDTHS.map((w) => ({ src: made(`/previews/home/${name}-${w}.mp4`), w })),- };- };+ // A moving tile: its poster (the clip's first frame) and its clip, each in every width it comes in; for a browser+ // without AVIF, the 1024 px clip's first frame as a JPEG.+ const moving = (id: string, name: string, widths: readonly number[] = BENTO_CLIP_WIDTHS): BentoMovingTile => ({+ id,+ poster: {+ avif: widths.map((w) => ({ src: made(`/previews/home/${name}-${w}.avif`), w })),+ fallback: made(`/previews/home/${name}-${BENTO_CLIP_FALLBACK}.jpg`),+ tint: HOME_BENTO_TINT[name],+ },+ clips: widths.map((w) => ({ src: made(`/previews/home/${name}-${w}.mp4`), w })),+ });const tile = (key: BentoKey, kind: string, meta: string, title: string, cta: string): BentoTile => ({key,meta,@@ -235,7 +232,7 @@ export async function homeBento(f: BentoFacts) {image: tile("image", "Image", `Image · ${f.imageModels} models`, "Portraits and campaigns", "Open Image"),audio: tile("audio", "Audio", `Audio · ${f.soundTools} sound tools`, "Voice, music, sound effects", "Open Audio"),threeD: tile("threeD", "3D", `3D · ${f.models3d} models`, "Spin it in 3D", "Open Image to 3D"),- restore: tile("restore", "Before and after", `One of ${f.apps} apps`, "Bring an old photo to color", `Open ${restore.name}`),+ genjutsu: tile("genjutsu", "Genjutsu", "Genjutsu", "Swap anyone in a clip", "Open Genjutsu"),numbers: {...tile("numbers", "Studios", "", "Every studio, app and effect", "All studios"),// Read as the numbers it shows, and say that it opens the list of studios in place.@@ -249,8 +246,14 @@ export async function homeBento(f: BentoFacts) {avif: [480, 768].map((w) => ({ src: made(`/previews/home/image-4-${w}.avif`), w })),fallback: example(BENTO_IMAGE_EXAMPLE.out),} satisfies BentoPicture,- threeD: moving("threeD"),- restore: { before: restoreSide("before"), after: restoreSide("after") },+ threeD: moving(BENTO_CLIPS.threeD, BENTO_CLIP_FILES.threeD),+ genjutsu: {+ ...moving(BENTO_GENJUTSU.id, BENTO_GENJUTSU.name, BENTO_GENJUTSU_WIDTHS),+ original: {+ avif: BENTO_ORIGINAL_WIDTHS.map((w) => ({ src: made(`/previews/home/${BENTO_GENJUTSU.original}-${w}.avif`), w })),+ fallback: example(GENJUTSU_ORIGINAL),+ } satisfies BentoPicture,+ },wave: { bars: HOME_BENTO_WAVE.bars, seconds: HOME_BENTO_WAVE.seconds },live: { frames: BENTO_LIVE_STEPS.map(frame), phrases: livePhrases(demo) },canvas: board(),diff --git a/tests/e2e/home-bento.mjs b/tests/e2e/home-bento.mjsindex 74a99077..20197bff 100644--- a/tests/e2e/home-bento.mjs+++ b/tests/e2e/home-bento.mjs@@ -13,7 +13,7 @@// 1. Every width (390, 768, 1024, 1280, 1440, 1920), light and dark, as a guest and as the owner: no sideways scroll,// one h1, the headline in its own words ("Make anything:" on one line; the second line whole from 768, and on a// phone two lines that break before "finished film,"), it rose into place once, and the first screen holds what it-// should (a phone: the video tile and the two under it; from 1024: all eight). A picture of each (--shots), and a+// should (a phone: the video tile and the live tile under it; from 1024: all eight). A picture of each (--shots), and a// contact sheet of them all.// 1b. Sharp at every width and pixel ratio (1x, 2x, 3x): every picture on the first screen is at least as wide as its// box shows it (object-fit: cover, times the ratio), up to the widest copy there is, and so is each clip once it@@ -36,7 +36,7 @@// is in, the headline looks as on a quick load (its picture within 1 level in 255 on average).// 3. Every tile's link answers 200, and the numbers tile opens every studio (the launcher; a phone's sheet).// 4. Reduced motion and Save-Data: no clip is fetched or played, nothing moves by itself (the headline is still, the-// split rests at 50 %, the live words stay), and the tiles keep their stills.+// live words stay), and the tiles keep their stills.// 5. Pause previews stops the reel and freezes every animation; pressed again, they go on.// 6. Weight: what the page downloads before `load` (clips aside), at 390 and 1440, reported; the first screen's own// stills stay under 420 KB (the clips' posters are encoded close to their clips' first frames, and a 3x phone or a@@ -90,7 +90,9 @@ const WIDTHS = [{ w: 1440, h: 900 },{ w: 1920, h: 1080 },];-const TILES = ["video", "image", "audio", "threeD", "restore", "numbers", "live", "canvas"];+const TILES = ["video", "live", "image", "threeD", "genjutsu", "audio", "numbers", "canvas"];+/** The tiles that play a clip by themselves (the reel, the 3D clip, Genjutsu's swap): each only once it is on screen. */+const MOVING = ["video", "threeD", "genjutsu"];/** The widest copy of a clip (scripts/gen-home-bento.mjs), where its element doesn't say (a reel clip's data-max). */const CLIP_MAX = 2048;/**@@ -241,9 +243,9 @@ if (run("1")));if (v.phone) {const bottom = l.vh - 64;- const first = ["video", "image", "threeD"];+ const first = ["video", "live"];const out = first.filter((t) => l.tiles[t].top < 0 || l.tiles[t].bottom > bottom);- check(`${tag}: the video tile and the two under it on the first screen`, out.length === 0, first.map((t) => `${t} ${Math.round(l.tiles[t].bottom)}`).join(", ") + ` ≤ ${bottom}`);+ check(`${tag}: the video tile and the live tile under it on the first screen`, out.length === 0, first.map((t) => `${t} ${Math.round(l.tiles[t].bottom)}`).join(", ") + ` ≤ ${bottom}`);check(`${tag}: every tile at least 44 px to tap`, TILES.every((t) => l.tiles[t].w >= 44 && l.tiles[t].h >= 44));}if (v.w >= 1024) {@@ -271,8 +273,15 @@ const watchSwap = () => {new PerformanceObserver((list) => {for (const e of list.getEntries()) if (!e.hadRecentInput) window.__shifts2.push({ v: e.value, at: Math.round(e.startTime) });}).observe({ type: "layout-shift", buffered: true });+ const MOVING = ["video", "threeD", "genjutsu"];+ // A tile below the fold plays only once it is scrolled to: the ones wholly on the first screen are watched.+ const onScreen = () =>+ MOVING.filter((t) => {+ const r = document.querySelector(`#home-bento [data-tile=${t}]`)?.getBoundingClientRect();+ return r && r.top >= 0 && r.bottom <= innerHeight;+ });const look = () => {- for (const t of ["video", "threeD"]) {+ for (const t of MOVING) {const tile = document.querySelector(`#home-bento [data-tile=${t}]`);if (!tile) continue;for (const el of tile.querySelectorAll("svg.lucide-play, [class*=play-glyph]")) {@@ -281,7 +290,8 @@ const watchSwap = () => {}if (!window.__shown[t] && tile.querySelector("video[data-ready]")) window.__shown[t] = Math.round(performance.now());}- if (performance.now() < 15_000 && !(window.__shown.video && window.__shown.threeD)) requestAnimationFrame(look);+ const on = onScreen();+ if (performance.now() < 15_000 && !(on.length && on.every((t) => window.__shown[t]))) requestAnimationFrame(look);};requestAnimationFrame(look);};@@ -294,9 +304,17 @@ if (run("1b"))const page = await ctx.newPage();await page.addInitScript(watchSwap);await open(page);- // The clips start once their tile's still is up and on screen: wait until each has its first frame.+ // The clips start once their tile's still is up and on screen: wait until each on the first screen has its first frame.+ const moving = await page.evaluate(+ (all) =>+ all.filter((t) => {+ const r = document.querySelector(`#home-bento [data-tile=${t}]`).getBoundingClientRect();+ return r.top >= 0 && r.bottom <= innerHeight;+ }),+ MOVING,+ );await page- .waitForFunction(() => ["video", "threeD"].every((t) => [...document.querySelectorAll(`#home-bento [data-tile=${t}] video`)].some((x) => x.videoWidth > 0)), null, { timeout: 12_000 })+ .waitForFunction((ts) => ts.every((t) => [...document.querySelectorAll(`#home-bento [data-tile=${t}] video`)].some((x) => x.videoWidth > 0)), moving, { timeout: 12_000 }).catch(() => {});await page.waitForTimeout(300);const s = await sharpness(page);@@ -304,7 +322,7 @@ if (run("1b"))const clips = s.filter((x) => x.what.endsWith(".mp4"));check(`sharp at ${v.w}@${dpr}x: ${s.length} pictures and clips at least their box x ratio`,- bad.length === 0 && new Set(clips.map((x) => x.tile)).size === 2,+ bad.length === 0 && moving.every((t) => clips.some((x) => x.tile === t)),(bad.length ? bad : clips).map((x) => `${x.tile} ${x.what} ${x.has} for ${x.need} (max ${x.max})`).join("; "),);sharpNotes.push(`${v.w}@${dpr}x: ${s.map((x) => `${x.tile} ${x.what} ${x.has}/${x.need}`).join(", ")}`);@@ -312,8 +330,8 @@ if (run("1b"))check(`no play sign at ${v.w}@${dpr}x on the tiles that play by themselves`, w.signs.length === 0, JSON.stringify(w.signs.slice(0, 3)));// Nothing shifts as a clip takes over from its still (from 100 ms before it shows to 600 ms after).const atSwap = w.shifts.filter((x) => Object.values(w.shown).some((t) => x.at >= t - 100 && x.at <= t + 600));- check(`no layout shift at the swap at ${v.w}@${dpr}x`, atSwap.length === 0 && Object.keys(w.shown).length === 2, `${JSON.stringify(w.shown)} load ${w.load}; ${JSON.stringify(atSwap)}`);- if (dpr === 2 || (v.phone && dpr === 3)) notes.push(`clips shown at ${v.w}@${dpr}x: video ${w.shown.video} ms, 3D ${w.shown.threeD} ms (load ${w.load} ms)`);+ check(`no layout shift at the swap at ${v.w}@${dpr}x`, atSwap.length === 0 && moving.every((t) => w.shown[t]), `${JSON.stringify(w.shown)} load ${w.load}; ${JSON.stringify(atSwap)}`);+ if (dpr === 2 || (v.phone && dpr === 3)) notes.push(`clips shown at ${v.w}@${dpr}x: video ${w.shown.video} ms, 3D ${w.shown.threeD} ms, Genjutsu ${w.shown.genjutsu} ms (load ${w.load} ms)`);await ctx.close();}@@ -348,8 +366,10 @@ if (run("1c"))const ctx = await browser.newContext({ ...(v.phone ? PHONE : {}), viewport: { width: v.w, height: v.h }, deviceScaleFactor: dpr });const page = await ctx.newPage();await open(page);- await page.waitForFunction(() => ["video", "threeD"].every((t) => document.querySelector(`#home-bento [data-tile=${t}] video[data-ready]`)), null, { timeout: 12_000 }).catch(() => {});- for (const tile of ["video", "threeD"]) {+ // Each moving tile, scrolled to where it isn't on the first screen (a phone's 3D and Genjutsu tiles).+ for (const tile of MOVING) {+ await page.locator(`#home-bento [data-tile=${tile}]`).scrollIntoViewIfNeeded();+ await page.waitForFunction((t) => document.querySelector(`#home-bento [data-tile=${t}] video[data-ready]`), tile, { timeout: 12_000 }).catch(() => {});if (!(await page.locator(`#home-bento [data-tile=${tile}] video[data-ready]`).count())) {check(`the swap at ${v.w}@${dpr}x, ${tile}: its clip plays`, false);continue;@@ -789,11 +809,9 @@ if (run("4")) {const state = await page.evaluate(() => ({play: document.getElementById("home-bento").dataset.play ?? null,videos: [...document.querySelectorAll("#home-bento video")].filter((v) => v.getAttribute("src") && !v.paused).length,- split: getComputedStyle(document.querySelector("#home-bento [data-tile=restore] picture:nth-of-type(2) img")).clipPath,headline: document.querySelector("#home-bento h1").parentElement.getAnimations({ subtree: true }).length,}));check("reduced motion: nothing moves by itself", state.play === null && state.videos === 0 && clips.length === 0 && state.headline === 0, JSON.stringify({ ...state, clips: clips.length }));- check("reduced motion: the split rests at 50 %", /inset\(0(px)? 50%/.test(state.split), state.split);check("reduced motion: the live words stay", a === b, `${JSON.stringify(a)} / ${JSON.stringify(b)}`);await ctx.close();diff --git a/tests/home-bento.test.ts b/tests/home-bento.test.tsindex 97493270..5593ee7a 100644--- a/tests/home-bento.test.ts+++ b/tests/home-bento.test.ts@@ -5,7 +5,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { createElement } from "react";import { renderToStaticMarkup } from "react-dom/server";import { describe, expect, it, vi } from "vitest";-import { APPS, EFFECTS, MODELS, MOTIONS, getPreset, modelCounts } from "@/lib/catalog";+import { APPS, EFFECTS, MODELS, MOTIONS, modelCounts } from "@/lib/catalog";import { getTemplate } from "@/lib/catalog/canvas";import { FORBIDDEN_WORDS } from "@/lib/examples/catalog";import { HUB_MODES } from "@/lib/hubs";@@ -30,7 +30,8 @@ vi.mock("next/navigation", () => ({useSearchParams: () => new URLSearchParams(),}));-const { BENTO_BOARD, BENTO_CLIPS, BENTO_CLIP_WIDTHS, BENTO_HREFS, BENTO_BEFORE_AFTER, BENTO_IMAGE_EXAMPLE, BENTO_REEL, BENTO_REEL_ID, livePhrases, openModelsOf } = await import("@/lib/home-bento");+const { BENTO_BOARD, BENTO_CLIPS, BENTO_CLIP_WIDTHS, BENTO_GENJUTSU, BENTO_GENJUTSU_WIDTHS, BENTO_HREFS, BENTO_IMAGE_EXAMPLE, BENTO_REEL, BENTO_REEL_ID, GENJUTSU_ORIGINAL, livePhrases, openModelsOf } =+ await import("@/lib/home-bento");const { HOME_BEFORE_AFTER, HOME_EFFECTS, HOME_MOTIONS, HOME_REVEALS, HOME_STUDIOS, homeShowcase, navLabel } = await import("@/lib/home-showcase");const { HomeBento } = await import("@/components/home/home-bento");@@ -84,6 +85,32 @@ describe("Home's first screen", () => {}});+ it("plays Genjutsu's group swap in the widths its render covers, cut as it is (no crossfade), beside the original", () => {+ const g = bento.genjutsu;+ expect(g.id).toBe(BENTO_GENJUTSU.id);+ // Its own id in the playback store: the studio's card lower down may play the same cover.+ expect(g.id).not.toBe(BENTO_GENJUTSU.cover);+ expect(g.clips.map((c) => c.w)).toEqual([...BENTO_GENJUTSU_WIDTHS]);+ for (const c of g.clips) {+ expect(c.src).toMatch(new RegExp(`^/previews/home/genjutsu-${c.w}\\.mp4\\?v=[0-9a-f]{8}$`));+ expect(mp4Size(file(c.src))).toEqual({ w: c.w, h: (c.w * 3) / 4 });+ // Five seconds of the take (120 frames at 24 fps), looped as it is.+ expect(mp4Seconds(file(c.src))).toBeCloseTo(5, 1);+ }+ expect(g.poster.avif.map((a) => a.w)).toEqual([...BENTO_GENJUTSU_WIDTHS]);+ for (const a of g.poster.avif) expect(a.src).toMatch(new RegExp(`^/previews/home/genjutsu-${a.w}\\.avif\\?v=`));+ expect(g.poster.fallback).toMatch(/^\/previews\/home\/genjutsu-1024\.jpg\?v=/);+ // The window: the original clip's first frame, the example's own published input.+ expect(g.original.fallback.split("?")[0]).toBe(GENJUTSU_ORIGINAL);+ expect(html).toContain(">Original<");+ expect(bento.tiles.genjutsu.href).toBe("/genjutsu");+ });++ it("leaves Colorize off the first screen", () => {+ expect(html).not.toMatch(/colorize|Bring an old photo/i);+ expect(Object.keys(bento.tiles)).not.toContain("restore");+ });+it("plays Sand Storm and One Take in turn, on the first one's first frame", () => {const v = bento.video;expect(v.id).toBe(BENTO_REEL_ID);@@ -105,17 +132,12 @@ describe("Home's first screen", () => {});it("lists every picture at its real width", async () => {- const pictures: BentoPicture[] = [bento.video.poster, bento.threeD.poster, bento.image, bento.restore.before, bento.restore.after];+ const pictures: BentoPicture[] = [bento.video.poster, bento.threeD.poster, bento.image, bento.genjutsu.poster, bento.genjutsu.original, ...bento.live.frames];for (const p of pictures)- for (const a of [...p.avif, ...(p.tall ?? [])]) {+ for (const a of p.avif) {const m = await sharp(file(a.src)).metadata();expect(m.width, a.src).toBe(a.w);}- // The tall crop is 3:5.- for (const a of bento.restore.after.tall ?? []) {- const m = await sharp(file(a.src)).metadata();- expect(m.width! / m.height!).toBeCloseTo(0.6, 2);- }});it("gives each tile a copy at least as wide as it shows, up to the widest there is", () => {@@ -141,9 +163,12 @@ describe("Home's first screen", () => {expect(widest).toBeGreaterThanOrEqual(1024);expect(pickWidth(c.clips, 1068).w).toBe(widest >= 1536 ? 1536 : widest);}- // The before/after pair covers a 3x phone (358 px wide) and the tall tile on a 2x 1920 screen.- expect(Math.max(...bento.restore.after.avif.map((a) => a.w))).toBeGreaterThanOrEqual(358 * 3);- expect(Math.max(...(bento.restore.after.tall ?? []).map((a) => a.w))).toBeGreaterThanOrEqual(602);+ // The live tile, the next biggest, covers a 3x phone (358 px wide) and its tile on a 2x 1440 screen (405 px under cover).+ for (const f of bento.live.frames) expect(Math.max(...f.avif.map((a) => a.w))).toBeGreaterThanOrEqual(Math.max(358 * 3, 405 * 2));+ // Genjutsu's clip is its render's own 1024 px, never made up past that: a 2x laptop's tile (376 px) gets it.+ expect(pickWidth(bento.genjutsu.clips, 376 * 2).w).toBe(1024);+ // The original's window (at most 132 px) is covered on a 3x screen.+ expect(Math.max(...bento.genjutsu.original.avif.map((a) => a.w))).toBeGreaterThanOrEqual(132 * 3);});it("opens a real page from every tile, named by the navigation or the catalog", () => {@@ -151,9 +176,8 @@ describe("Home's first screen", () => {const seg = href.split(/[?#]/)[0].replace(/^\//, "");return fs.existsSync(path.join(root, "src", "app", "(studio)", seg, "page.tsx"));};- for (const href of [BENTO_HREFS.video, BENTO_HREFS.image, BENTO_HREFS.audio, BENTO_HREFS.threeD, BENTO_HREFS.live, BENTO_HREFS.canvas]) expect(route(href), href).toBe(true);- expect(fs.existsSync(path.join(root, "src", "app", "(studio)", "apps", "[id]", "page.tsx"))).toBe(true);- expect(APPS.some((a) => a.id === BENTO_BEFORE_AFTER)).toBe(true);+ for (const href of [BENTO_HREFS.video, BENTO_HREFS.image, BENTO_HREFS.audio, BENTO_HREFS.threeD, BENTO_HREFS.genjutsu, BENTO_HREFS.live, BENTO_HREFS.canvas])+ expect(route(href), href).toBe(true);const plan = JSON.parse(fs.readFileSync(path.join(root, "src", "lib", "examples", "plan.json"), "utf8")) as { id: string; surface: string; output?: string }[];expect(plan.find((r) => r.id === BENTO_IMAGE_EXAMPLE.id)).toMatchObject({ surface: "studio:image", output: BENTO_IMAGE_EXAMPLE.out });expect(BENTO_HREFS.numbers).toBe("#home-studios");@@ -166,19 +190,19 @@ describe("Home's first screen", () => {expect(t.threeD.cta).toBe(`Open ${navLabel("/image-to-3d")}`);expect(t.live.cta).toBe(`Open ${navLabel("/live-edit")}`);expect(t.canvas.cta).toBe(`Open ${navLabel("/canvas")}`);- expect(t.restore.cta).toBe(`Open ${getPreset(BENTO_BEFORE_AFTER)!.name}`);+ expect(t.genjutsu.cta).toBe(`Open ${navLabel("/genjutsu")}`);});it("makes every tile one link with a name, in the grid's reading order", () => {const links = [...html.matchAll(/<a [^>]*>/g)].map((m) => m[0]);const tiles = links.filter((a) => a.includes("data-tile="));- expect(tiles.map((a) => /data-tile="([^"]+)"/.exec(a)![1])).toEqual(["video", "image", "audio", "threeD", "restore", "numbers", "live", "canvas"]);+ expect(tiles.map((a) => /data-tile="([^"]+)"/.exec(a)![1])).toEqual(["video", "live", "image", "threeD", "genjutsu", "audio", "numbers", "canvas"]);for (const a of tiles) {const label = /aria-label="([^"]+)"/.exec(a)?.[1];expect(label, a).toBeTruthy();expect(label!.length).toBeGreaterThan(10);}- const KINDS = { video: "Video", image: "Image", audio: "Audio", threeD: "3D", restore: "Before and after", live: "Live edit", canvas: "Canvas" };+ const KINDS = { video: "Video", image: "Image", audio: "Audio", threeD: "3D", genjutsu: "Genjutsu", live: "Live edit", canvas: "Canvas" };for (const [key, kind] of Object.entries(KINDS)) {const t = bento.tiles[key as keyof typeof KINDS];expect(t.label).toBe(`${kind}: ${t.title}. ${t.cta}`);@@ -195,7 +219,7 @@ describe("Home's first screen", () => {expect(h1).toContain("finished film,");expect(h1).toContain("one place.");// The note under it, both sentences whole, and nothing hidden shipped with it.- expect(html).toContain("Film, stills, sound, 3D, live edits and whole pipelines. Each tile opens the studio that makes it.");+ expect(html).toContain("Film, live edits, swaps, stills, sound, 3D and whole pipelines. Each tile opens the studio that makes it.");expect(html).not.toMatch(/data-hero|hb-eyebrow|hb-vignette/);});@@ -244,6 +268,7 @@ describe("Home's first screen", () => {// The video tile plays its reel under its own id; the 3D tile's preset plays nowhere else.const ids = [BENTO_REEL_ID,+ BENTO_GENJUTSU.id,...Object.values(BENTO_CLIPS),...[...HOME_EFFECTS, ...HOME_MOTIONS, ...HOME_REVEALS].map((r) => r.id),...HOME_BEFORE_AFTER.map((p) => p.id),@@ -280,7 +305,7 @@ describe("Home's first screen", () => {expect(bento.live.frames).toHaveLength(4);for (const [i, f] of bento.live.frames.entries()) {const fr = demo.frames[`s${i}`];- expect(f.avif.map((a) => a.src)).toEqual([fr.small, fr.mid]);+ expect(f.avif.map((a) => a.src)).toEqual([fr.small, fr.mid, fr.src]);expect(f.fallback).toBe(fr.webp);}});