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
Frames mode: an Animation style with a timing chip per gap, playback rate and a still mouth; Storyboard and Character Sheet open their pictures as keyframes
Clauded7bfaa3cfe7c
diff --git a/src/components/element-studio.tsx b/src/components/element-studio.tsxindex e437fc35..553f963c 100644--- a/src/components/element-studio.tsx+++ b/src/components/element-studio.tsx@@ -9,6 +9,7 @@ import { StudioSkeleton } from "@/components/skeletons";import { StudioPage } from "@/components/studio/studio-page";import type { StudioConfig } from "@/components/studio/studio-context";import { TrainDialog } from "@/components/train-dialog";+import { AnimatePosesButton } from "@/components/turnaround/animate-poses";import { TurnaroundButton, useCharacterPictures } from "@/components/turnaround/turnaround-dialog";import { Button } from "@/components/ui/button";import { useElement } from "@/lib/api";@@ -104,6 +105,7 @@ export function ElementStudio({ id }: { id: string }) {{el.kind === "character" && el.references.length > 0 && (<TurnaroundButton flyAround label="Fly around" variant="ghost" compact pictures={pictures} name={el.name} elementId={el.id} realPerson />)}+ {el.kind === "character" && <AnimatePosesButton variant="ghost" compact pictures={pictures} name={el.name} />}<Button variant="ghost" size="sm" onClick={() => setEditing(true)} aria-label={`Edit ${el.name}`}><Pencil /> <span className="hidden sm:inline">Edit</span></Button>diff --git a/src/components/fashion/character-sheet.tsx b/src/components/fashion/character-sheet.tsxindex 8ac7be2c..d8dca860 100644--- a/src/components/fashion/character-sheet.tsx+++ b/src/components/fashion/character-sheet.tsx@@ -15,6 +15,7 @@ import { radioKeys, radioTab } from "@/components/studio/radio-keys";import { useRun, useRunPreview } from "@/components/photodump/hooks";import { ResultsGrid } from "@/components/photodump/results";import { RunLine } from "@/components/photodump/steps";+import { AnimatePosesButton } from "@/components/turnaround/animate-poses";import { TurnaroundButton } from "@/components/turnaround/turnaround-dialog";import { useElements, useEngine, useGenerations, useLikelyVisitor, useSaveElement } from "@/lib/api";import { castFieldVisible, castNameFor, randomCast, SHEET_MAX_REFS, type CastAnswers, type CastFieldData } from "@/lib/catalog/packs";@@ -325,6 +326,7 @@ export function CharacterSheetView({ fields, defaults }: { fields: CastFieldData// Photos someone brought are of a real person: the consent line is asked for.realPerson={(latest.request.inputs?.images ?? []).some((u) => u.startsWith("/api/files/"))}/>+ <AnimatePosesButton key={`poses-${latest.id}`} pictures={sheetPictures(latest)} name={mode === "cast" ? castNameFor(cast) : undefined} /></div><SaveCharacterkey={`save-${latest.id}`}diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsxindex 3a0c080a..a95c748b 100644--- a/src/components/storyboard-view.tsx+++ b/src/components/storyboard-view.tsx@@ -24,6 +24,7 @@ import { lookCard } from "@/lib/catalog/soul-cards";import type { Engine, Generation } from "@/lib/catalog/types";import { timeAgo } from "@/lib/format";import { BOARD_TITLES_KEY, boardTitle, filmReady, rememberTitle } from "@/lib/storyboard-board";+import { animateHref, MAX_KEYS } from "@/lib/inbetween";import { cn } from "@/lib/utils";import { responseError, toastError } from "@/lib/refusals";@@ -260,7 +261,31 @@ function Board({{frames.length} frames · {done === frames.length ? "done" : `${done}/${frames.length} ready`} · {modelName(first, names)} · {timeAgo(first.createdAt)}</p></div>- <div className="flex shrink-0 items-center gap-1">+ <div className="flex shrink-0 flex-wrap items-center gap-1">+ {frames.length > 1 && (+ <Tooltip>+ <TooltipTrigger asChild>+ {ready ? (+ <Button asChild variant="ghost" size="sm" className="whitespace-nowrap">+ <Link href={animateHref(frames.map((f) => f.outputs[0]?.url).filter((u): u is string => !!u), idea)} data-animate-panels>+ <Sparkles /> Animate these panels+ </Link>+ </Button>+ ) : (+ <span tabIndex={0} className="inline-flex rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring">+ <Button variant="ghost" size="sm" disabled className="whitespace-nowrap">+ <Sparkles /> Animate these panels+ </Button>+ </span>+ )}+ </TooltipTrigger>+ <TooltipContent>+ {ready+ ? `The panels become keyframes${frames.length > MAX_KEYS ? ` (the first ${MAX_KEYS})` : ""}, and the motion between them is drawn in an animation style`+ : `Ready when all ${frames.length} frames are done`}+ </TooltipContent>+ </Tooltip>+ )}{!film.length && frames.length > 1 && first.batchId && (<Tooltip><TooltipTrigger asChild>diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 1aa80581..e5945c6e 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -37,6 +37,7 @@ import {OPEN_MIN_GAP,type FrameSupport,} from "@/lib/catalog/keyframes";+import { timingFor, timingFromTimes, timingProblem, type InbetweenTiming } from "@/lib/inbetween";import { appModels, presetGpuKey, presetRoutes, recipeRoute } from "@/lib/catalog/preset-recipe-routes";import {appRoute,@@ -150,6 +151,8 @@ interface FramesContext {support: FrameSupport;duration: number;chained: boolean;+ /** Keyframe animation (Fuobe Animation): each gap's timing, fitted to the frames and the engine. */+ animation?: { timing: InbetweenTiming };}function buildRequest(@@ -177,7 +180,7 @@ function buildRequest(const sent = framesRequest(draft.frames, frames);images = sent.images;endImage = sent.endImage;- params = { ...params, ...sent.params };+ params = { ...params, ...sent.params, ...(frames.animation && { extra: { ...params.extra, inbetween: frames.animation.timing } }) };pinned = op ?? sent.op;}// Layout mode: the boxes ride as params.extra.layout, captioned with the prompt; the plan compiles them for the model.@@ -552,11 +555,30 @@ export function Composer({ docked }: { docked: boolean }) {// Frames mode (Video studio): up to 10 stills at their times, as the picked model can take them.const framesOn = !!config.frames && !!draft.frames;+ // Style: Animation (Fuobe Animation): keyframes with a timing per gap, the in-betweens drawn by AniSora.+ const animationOn = framesOn && !!model?.options.inbetween;+ // Until a gap is timed, the frames' places on the strip give the timing (Frames mode's times, at the playback rate).+ const savedTiming = draft.params.extra?.inbetween as Partial<InbetweenTiming> | undefined;+ const animationTiming =+ animationOn && model && draft.frames+ ? savedTiming?.gaps+ ? timingFor(draft.frames.length, savedTiming, model.engine)+ : timingFromTimes(frameTimes(draft.frames.map((f) => f.at), framesDuration(model, draft.params.duration)), { engine: model.engine })+ : undefined;const framesCtx: FramesContext | undefined =- framesOn && model ? { support: frameSupport(model), duration: framesDuration(model, draft.params.duration), chained: !!keyframeChain(model) } : undefined;+ framesOn && model+ ? { support: frameSupport(model), duration: framesDuration(model, draft.params.duration), chained: !!keyframeChain(model), ...(animationTiming && { animation: { timing: animationTiming } }) }+ : undefined;const framesAt = framesCtx && draft.frames ? frameTimes(draft.frames.map((f) => f.at), framesCtx.duration) : [];// The open chain's gaps (and one frame's clip) must be clips its model makes; the planner checks two or more frames too.- const framesGap = framesCtx?.chained && model && framesAt.length ? chainGapProblem(framesAt, framesCtx.duration, chainTiming(model)) : null;+ // An animation's gaps are its own timing (two keyframes at least).+ const framesGap = animationTiming+ ? draft.frames!.length > 0 && draft.frames!.length < 2+ ? "Add a second keyframe: the in-betweens go between them"+ : timingProblem(animationTiming, draft.frames!.length, model!.engine)+ : framesCtx?.chained && model && framesAt.length+ ? chainGapProblem(framesAt, framesCtx.duration, chainTiming(model))+ : null;// Layout mode (Image studio): boxes on the picture, one row each, compiled for the model at the size it renders.const layoutOn = !!config.layout && !!draft.layout;const [layoutEditing, setLayoutEditing] = useState(false);@@ -1005,7 +1027,19 @@ export function Composer({ docked }: { docked: boolean }) {if (framesCtx.support === "start" || framesCtx.support === "none") framesNotice = { text: `${framesBlocker(model, count)!.message}.`, tone: "warn", action };else if (framesGap) framesNotice = { text: `${framesGap}.`, tone: "warn" };else if (note) framesNotice = { text: note, tone: "info", action };+ else if (animationTiming && model.engine === "cloud")+ framesNotice = { text: "In the cloud each gap is one clip with every frame kept, played at 16 fps. Faster speeds and 24 fps playback are on your GPU, free.", tone: "info" };}+ // Style: Animation, in Frames mode: Fuobe Animation (when it's on in this install), and back to the engine's frames model.+ const animationModel = config.frames && catalog.offered("fuobe-animation", engine) ? catalog.getModel("fuobe-animation") : undefined;+ const plainFramesModel = catalog.getModel(FRAMES_MODELS[engine].id);+ const switchStyle = (on: boolean) => {+ const to = on ? animationModel : plainFramesModel;+ if (!to) return;+ setDraft((d) => ({ modelId: to.id, params: { ...to.defaults, ...d.params, resolution: to.defaults?.resolution ?? d.params.resolution, aspectRatio: to.defaults?.aspectRatio ?? d.params.aspectRatio } }));+ };+ const setTiming = (t: InbetweenTiming) => setDraft((d) => ({ params: { ...d.params, extra: { ...d.params.extra, inbetween: t } } }));+ const stillMouth = draft.params.extra?.stillMouth === true;const framesChip = config.frames ? (<Tooltip><TooltipTrigger asChild>@@ -1153,6 +1187,18 @@ export function Composer({ docked }: { docked: boolean }) {onAddPick={attach.attach}onClose={toggleFrames}notice={framesNotice}+ style={animationModel ? { on: animationOn, onChange: switchStyle, engine } : undefined}+ animation={+ animationTiming && model+ ? {+ timing: animationTiming,+ engine: model.engine,+ onTiming: setTiming,+ stillMouth,+ onStillMouth: (on) => setDraft((d) => ({ params: { ...d.params, extra: { ...d.params.extra, stillMouth: on || undefined } } })),+ }+ : undefined+ }/>)}{layoutOn && !collapsed && draft.layout && (diff --git a/src/components/studio/frames-strip.tsx b/src/components/studio/frames-strip.tsxindex 58d0d7a7..81b264c4 100644--- a/src/components/studio/frames-strip.tsx+++ b/src/components/studio/frames-strip.tsx@@ -1,9 +1,30 @@"use client";import { Loader2, Minus, Plus, TriangleAlert, X } from "lucide-react";-import { useId, useRef, useState } from "react";+import { Fragment, useId, useRef, useState } from "react";import { toast } from "sonner";+import { Input } from "@/components/ui/input";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import { Switch } from "@/components/ui/switch";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import {+ ENGINE_TIMING,+ gapLabel,+ gapSeconds,+ keyTimes,+ lengthLabel,+ MAX_GAP_FRAMES,+ MIN_GAP_FRAMES,+ moveKey,+ SPEEDS,+ stepGap,+ totalFrames,+ totalSeconds,+ type GapTiming,+ type InbetweenTiming,+ type PlaybackFps,+} from "@/lib/inbetween";+import type { Engine } from "@/lib/catalog/types";import { useAskBeforeUpload } from "@/lib/api";import { FRAMES_HINT, frameRange, frameRole, frameTimes, KEYFRAME_SNAP, MAX_KEYFRAMES, secondsLabel } from "@/lib/catalog/keyframes";import type { FrameAttachment } from "@/lib/composer";@@ -17,6 +38,15 @@ export interface FramesNotice {action?: { label: string; onClick: () => void };}+/** Keyframe animation's controls (Fuobe Animation): each gap's timing, the playback rate and a still mouth. */+export interface FramesAnimation {+ timing: InbetweenTiming;+ engine: Engine;+ onTiming: (t: InbetweenTiming) => void;+ stillMouth: boolean;+ onStillMouth: (on: boolean) => void;+}+const pct = (t: number, duration: number) => `${duration > 0 ? (t / duration) * 100 : 0}%`;/**@@ -36,6 +66,8 @@ export function FramesStrip({onAddPick,onClose,notice,+ style,+ animation,}: {frames: FrameAttachment<SlotValue>[];duration: number;@@ -50,10 +82,17 @@ export function FramesStrip({onAddPick: (v: SlotValue) => void;onClose: () => void;notice?: FramesNotice | null;+ /** Style: Animation, when Fuobe Animation can run here. */+ style?: { on: boolean; onChange: (on: boolean) => void; engine: Engine };+ animation?: FramesAnimation;}) {const titleId = useId();const hintId = useId();- const times = frameTimes(frames.map((f) => f.at), duration);+ const styleId = useId();+ // An animation's keyframes sit where their gaps' timing puts them; the film is as long as the gaps.+ const length = animation ? totalSeconds(animation.timing) : duration;+ const times = animation ? keyTimes(animation.timing) : frameTimes(frames.map((f) => f.at), duration);+ const setGap = (i: number, g: GapTiming) => animation?.onTiming({ ...animation.timing, gaps: animation.timing.gaps.map((x, j) => (j === i ? g : x)) });return (<div role="group" aria-labelledby={titleId} aria-describedby={hintId} data-frames-strip className="space-y-1.5 px-1 pt-1 pb-2"><div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 pl-1">@@ -64,7 +103,22 @@ export function FramesStrip({{FRAMES_HINT}</span><div className="ml-auto flex items-center gap-1">- <LengthStepper value={duration} options={durations} onDuration={onDuration} />+ {style && (+ <label htmlFor={styleId} className="mr-1 flex cursor-pointer items-center gap-1.5 text-[12px] font-medium">+ <Switch id={styleId} checked={style.on} onCheckedChange={style.onChange} aria-describedby={`${styleId}-hint`} />+ Animation+ <span id={`${styleId}-hint`} className="sr-only">+ The in-betweens drawn in an anime style, with a timing for each gap{style.engine === "open" ? ", free on your GPU" : ""}+ </span>+ </label>+ )}+ {animation ? (+ <span className="rounded-full bg-muted px-2.5 py-1 text-[12px] font-medium tabular-nums" aria-live="polite" data-animation-length>+ {lengthLabel(length)} · {totalFrames(animation.timing)} frames+ </span>+ ) : (+ <LengthStepper value={duration} options={durations} onDuration={onDuration} />+ )}<Tooltip><TooltipTrigger asChild><button@@ -83,15 +137,19 @@ export function FramesStrip({<div className="scrollbar-none flex items-start gap-2 overflow-x-auto px-1 pt-1.5">{frames.map((f, i) => (- <FrameTile- key={f.value.id ?? `${f.value.ref}-${i}`}- index={i}- role={frameRole(i, frames.length, f.at)}- value={f.value}- time={times[i]}- onChange={(v) => onFrame(i, v)}- onFile={(file) => onFrameFile(i, file)}- />+ <Fragment key={f.value.id ?? `${f.value.ref}-${i}`}>+ {animation && i > 0 && animation.timing.gaps[i - 1] && (+ <GapChip index={i - 1} gap={animation.timing.gaps[i - 1]} fps={animation.timing.fps} engine={animation.engine} onChange={(g) => setGap(i - 1, g)} />+ )}+ <FrameTile+ index={i}+ role={animation ? (i === 0 ? "Start frame" : "Middle frame") : frameRole(i, frames.length, f.at)}+ value={f.value}+ time={times[i] ?? 0}+ onChange={(v) => onFrame(i, v)}+ onFile={(file) => onFrameFile(i, file)}+ />+ </Fragment>))}{frames.length < MAX_KEYFRAMES && (<div className="flex shrink-0 flex-col items-center gap-1">@@ -103,7 +161,17 @@ export function FramesStrip({)}</div>- {frames.length > 0 && <Ruler frames={frames} times={times} duration={duration} onMove={onMove} />}+ {frames.length > 0 && (+ <Ruler+ frames={frames}+ times={times}+ duration={Math.max(length, 0.1)}+ onMove={animation ? (i, seconds) => animation.onTiming(moveKey(animation.timing, i, seconds)) : onMove}+ lastFree={!!animation}+ />+ )}++ {animation && <AnimationOptions animation={animation} />}{notice && (// A warning (Generate waits for it) reads in the body colour beside an amber icon: amber text on white is under 4.5:1.@@ -257,7 +325,20 @@ const labelEvery = (d: number) => (d <= 5 ? 1 : d <= 10 ? 2 : d <= 20 ? 5 : 10);* The time ruler: one marker per frame at its time. Drag a marker (it snaps to 0.1 s and stays between* its neighbours), or focus it and use the arrow keys (0.1 s; Shift or Page Up / Down: 1 s; Home / End).*/-function Ruler({ frames, times, duration, onMove }: { frames: FrameAttachment<SlotValue>[]; times: number[]; duration: number; onMove: (i: number, seconds: number) => void }) {+function Ruler({+ frames,+ times,+ duration,+ onMove,+ lastFree,+}: {+ frames: FrameAttachment<SlotValue>[];+ times: number[];+ duration: number;+ onMove: (i: number, seconds: number) => void;+ /** An animation: the last keyframe can move later (the film grows with it). */+ lastFree?: boolean;+}) {const track = useRef<HTMLDivElement>(null);const [active, setActive] = useState<number | null>(null);const secondsAt = (clientX: number) => {@@ -283,7 +364,8 @@ function Ruler({ frames, times, duration, onMove }: { frames: FrameAttachment<Sl{thumb}</span>);- const [lo, hi] = frameRange(times, i, duration);+ const [lo, hi0] = frameRange(times, i, duration);+ const hi = lastFree && i === frames.length - 1 ? hi0 + 5 : hi0;const step = (by: number) => onMove(i, times[i] + by);return (<button@@ -350,3 +432,103 @@ function Ruler({ frames, times, duration, onMove }: { frames: FrameAttachment<Sl</div>);}++/** One gap's timing on the strip, between its two keyframes: frames and speed, and a popover to change them and its words. */+function GapChip({ index, gap, fps, engine, onChange }: { index: number; gap: GapTiming; fps: PlaybackFps; engine: Engine; onChange: (g: GapTiming) => void }) {+ const can = ENGINE_TIMING[engine];+ const name = `keyframes ${index + 1} and ${index + 2}`;+ return (+ <Popover>+ <PopoverTrigger asChild>+ <button+ type="button"+ data-gap-chip={index}+ aria-label={`Timing between ${name}: ${gap.frames} frames, ${gap.speed === 1 ? "every frame" : `every ${gap.speed}th frame`}, ${lengthLabel(gapSeconds(gap, fps))}`}+ className="mt-3.5 flex h-8 shrink-0 flex-col items-center justify-center rounded-full border bg-background px-2 text-[10.5px] leading-tight font-medium tabular-nums shadow-soft outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50"+ >+ <span>{gapLabel(gap)}</span>+ <span className="text-muted-foreground">{lengthLabel(gapSeconds(gap, fps))}</span>+ </button>+ </PopoverTrigger>+ <PopoverContent className="w-72 space-y-3 p-3" align="center">+ <p className="text-[13px] font-medium">+ Keyframes {index + 1} → {index + 2}+ </p>+ <div className="flex items-center justify-between gap-2">+ <span className="text-[12px] text-muted-foreground">Frames drawn</span>+ <div role="group" aria-label="Frames drawn" className="flex items-center gap-0.5 rounded-full bg-muted p-0.5">+ <button type="button" aria-label="Fewer frames" disabled={gap.frames <= MIN_GAP_FRAMES} onClick={() => onChange(stepGap(gap, -1))} className="grid size-6 place-items-center rounded-full hover:bg-background disabled:opacity-40">+ <Minus className="size-3" />+ </button>+ <span className="min-w-10 text-center text-[12px] font-medium tabular-nums">{gap.frames}</span>+ <button type="button" aria-label="More frames" disabled={gap.frames >= MAX_GAP_FRAMES} onClick={() => onChange(stepGap(gap, 1))} className="grid size-6 place-items-center rounded-full hover:bg-background disabled:opacity-40">+ <Plus className="size-3" />+ </button>+ </div>+ </div>+ <div className="space-y-1">+ <div className="flex items-center justify-between gap-2">+ <span className="text-[12px] text-muted-foreground">Speed</span>+ <div role="radiogroup" aria-label="Speed" className="flex items-center gap-0.5 rounded-full bg-muted p-0.5">+ {SPEEDS.map((sp) => {+ const allowed = can.speeds.includes(sp);+ return (+ <button+ key={sp}+ type="button"+ role="radio"+ aria-checked={gap.speed === sp}+ disabled={!allowed}+ title={allowed ? undefined : "On your GPU"}+ onClick={() => onChange({ ...gap, speed: sp })}+ className={cn("h-6 min-w-8 rounded-full px-1.5 text-[12px] font-medium tabular-nums disabled:opacity-40", gap.speed === sp ? "bg-background shadow-soft" : "hover:bg-background/60")}+ >+ ×{sp}+ </button>+ );+ })}+ </div>+ </div>+ <p className="text-[11px] leading-snug text-muted-foreground">+ {engine === "open" ? "Faster keeps every 2nd, 3rd or 4th frame, for a snappier move." : "In the cloud every frame is kept. ×2–×4 are on your GPU."} This gap plays for {lengthLabel(gapSeconds(gap, fps))}.+ </p>+ </div>+ <label className="block space-y-1">+ <span className="text-[12px] text-muted-foreground">What happens in this gap (optional)</span>+ <Input value={gap.prompt ?? ""} maxLength={500} placeholder="she jumps and lands" onChange={(e) => onChange({ ...gap, prompt: e.target.value || undefined })} className="h-8 text-[13px]" />+ </label>+ </PopoverContent>+ </Popover>+ );+}++/** The animation's playback rate and the still-mouth switch, under the ruler. */+function AnimationOptions({ animation }: { animation: FramesAnimation }) {+ const mouthId = useId();+ const rates = ENGINE_TIMING[animation.engine].rates;+ return (+ <div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 px-1 text-[12px]">+ <div role="radiogroup" aria-label="Playback" className="flex items-center gap-1.5">+ <span className="text-muted-foreground">Playback</span>+ <div className="flex items-center gap-0.5 rounded-full bg-muted p-0.5">+ {rates.map((r) => (+ <button+ key={r}+ type="button"+ role="radio"+ aria-checked={animation.timing.fps === r}+ onClick={() => animation.onTiming({ ...animation.timing, fps: r })}+ className={cn("h-6 rounded-full px-2 font-medium tabular-nums", animation.timing.fps === r ? "bg-background shadow-soft" : "hover:bg-background/60")}+ >+ {r} fps{r === 16 && rates.length > 1 ? " · true time" : ""}+ </button>+ ))}+ </div>+ </div>+ <label htmlFor={mouthId} className="flex cursor-pointer items-center gap-1.5">+ <Switch id={mouthId} checked={animation.stillMouth} onCheckedChange={animation.onStillMouth} />+ Keep mouth still+ </label>+ </div>+ );+}diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsxindex ba89cf3f..c865d892 100644--- a/src/components/studio/studio-page.tsx+++ b/src/components/studio/studio-page.tsx@@ -15,6 +15,7 @@ import { GUEST_PROMPT_EVENT, useEngine, useGenerations, useIsGuest } from "@/libimport {claimStartToken,followEngineDefault,+ handoffFrames,handoffKey,mergeHandoff,presetModel,@@ -28,7 +29,7 @@ import {} from "@/lib/composer";import { presetGpuKey, presetRoutes } from "@/lib/catalog/preset-recipe-routes";import { editableLayout, EDIT_LAYOUT_PARAM, readEditLayoutParam } from "@/lib/output-actions";-import { positionsFrom } from "@/lib/catalog/keyframes";+import { positionsFrom, spread } from "@/lib/catalog/keyframes";import { reuseSignature, withSignatureWords } from "@/lib/catalog/palettes";import { movedAppRequest } from "@/lib/catalog/plan";import { currentModelId, migrateRequest } from "@/lib/catalog/replaced";@@ -141,6 +142,9 @@ function initialDraft(const format = model?.options.formats?.find((f) => f === sp.get("format"));// A size handed over (Regenerate in 2K → 1440p), when the model offers it.const resolution = model?.options.resolutions?.find((r) => r === sp.get("resolution"));+ // Stills handed over as frames (Storyboard's "Animate these panels", a Character Sheet's poses): Frames mode, evenly spaced.+ const handed = config.frames ? handoffFrames(sp.get("frames")) : [];+ const frames = handed.length ? handed.map((u, i) => ({ value: slot(u)!, at: spread(handed.length)[i] })) : undefined;return {prompt: sp.get("prompt") ?? "",negativePrompt: "",@@ -150,6 +154,7 @@ function initialDraft(refs,presetId: sp.get("preset") ?? config.preset?.id,presetOptions: {},+ ...(frames && { frames }),};}diff --git a/src/components/turnaround/animate-poses.tsx b/src/components/turnaround/animate-poses.tsxnew file mode 100644index 00000000..297a9bf7--- /dev/null+++ b/src/components/turnaround/animate-poses.tsx@@ -0,0 +1,80 @@+"use client";++import { Check, Sparkles } from "lucide-react";+import Link from "next/link";+import { useState } from "react";+import { Button } from "@/components/ui/button";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import type { TurnPicture } from "@/lib/catalog/turnaround";+import { animateHref, MAX_KEYS, MIN_KEYS } from "@/lib/inbetween";+import { cn } from "@/lib/utils";++/**+ * "Animate between poses" (Character Sheet, a character element): pick two or more of the character's poses in the order+ * they should play, and the Video studio opens in Frames mode with them as keyframes, in Animation style.+ */+export function AnimatePosesButton({+ pictures,+ name,+ compact,+ variant = "outline",+}: {+ pictures: TurnPicture[];+ name?: string;+ compact?: boolean;+ variant?: "outline" | "ghost" | "secondary";+}) {+ // Single poses only: a whole sheet holds several views in one picture.+ const poses = pictures.filter((p) => !p.sheet);+ const [picked, setPicked] = useState<string[]>(() => poses.slice(0, Math.min(poses.length, 3)).map((p) => p.url));+ if (poses.length < MIN_KEYS) return null;+ const toggle = (url: string) => setPicked((xs) => (xs.includes(url) ? xs.filter((x) => x !== url) : xs.length < MAX_KEYS ? [...xs, url] : xs));+ const prompt = name ? `${name} moves from pose to pose` : undefined;+ return (+ <Popover>+ <PopoverTrigger asChild>+ <Button variant={variant} size="sm" aria-label="Animate between poses" data-animate-poses>+ <Sparkles /> <span className={cn(compact && "hidden sm:inline")}>Animate between poses</span>+ </Button>+ </PopoverTrigger>+ <PopoverContent className="w-80 space-y-3 p-3" align="end">+ <div className="space-y-0.5">+ <p className="text-[13px] font-medium">Animate between poses</p>+ <p className="text-[12px] leading-snug text-muted-foreground">Pick the poses in the order they play. The motion between them is drawn in an animation style.</p>+ </div>+ <div className="grid grid-cols-4 gap-2" role="group" aria-label="Poses">+ {poses.map((p) => {+ const at = picked.indexOf(p.url);+ return (+ <button+ key={p.url}+ type="button"+ aria-pressed={at >= 0}+ aria-label={`${p.label}${at >= 0 ? `, keyframe ${at + 1}` : ""}`}+ onClick={() => toggle(p.url)}+ className={cn("relative aspect-square overflow-hidden rounded-lg border bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring/50", at >= 0 && "ring-2 ring-primary")}+ >+ {/* eslint-disable-next-line @next/next/no-img-element */}+ <img src={p.url} alt="" className="size-full object-cover" />+ {at >= 0 && (+ <span className="absolute top-1 left-1 grid size-5 place-items-center rounded-full bg-primary text-[10px] font-semibold text-primary-foreground tabular-nums">{at + 1}</span>+ )}+ </button>+ );+ })}+ </div>+ {picked.length >= MIN_KEYS ? (+ <Button asChild size="sm" className="w-full">+ <Link href={animateHref(picked, prompt)}>+ <Check /> Animate {picked.length} poses+ </Link>+ </Button>+ ) : (+ <Button size="sm" className="w-full" disabled>+ Pick at least two poses+ </Button>+ )}+ </PopoverContent>+ </Popover>+ );+}diff --git a/src/lib/composer.ts b/src/lib/composer.tsindex 7d1da00c..1d7540ce 100644--- a/src/lib/composer.ts+++ b/src/lib/composer.ts@@ -10,6 +10,7 @@ import { wholeClipProblem, wholeClipTool } from "./av/video-finish";import { clipFpsProblem, clipSizeProblem, clipWindowProblem } from "./catalog/clip-windows";import { clipBilling } from "./catalog/plan";import { addFrameAt, frameTimes, framesInputs, removeFrameAt, spread, type FrameSupport } from "./catalog/keyframes";+import { keyTimes, totalSeconds, type InbetweenTiming } from "./inbetween";import { FACE_MOSAIC_MODELS } from "./catalog/open-tools";import { pricingOn, type PriceClock } from "./catalog/promo";import { soulPostStep } from "./catalog/soul";@@ -592,8 +593,19 @@ export function enterFrames<T extends Attachment>(slots: Partial<Record<InputSlo*/export function framesRequest(frames: FrameAttachment[],- ctx: { support: FrameSupport; duration: number; chained: boolean },+ ctx: { support: FrameSupport; duration: number; chained: boolean; animation?: { timing: InbetweenTiming } },): { op?: "keyframes"; images: string[]; endImage?: string; params: Pick<GenParams, "duration" | "keyframeTimes" | "shots" | "multiShot" | "numOutputs"> } {+ // Keyframe animation (Fuobe Animation): the keyframes sit where their gaps' timing puts them, and the film is as long as the gaps.+ if (ctx.animation) {+ const times = keyTimes(ctx.animation.timing);+ const refs = frames.map((f) => f.value.ref).filter((r): r is string => !!r);+ const whole = refs.length === frames.length;+ return {+ op: "keyframes",+ images: refs,+ params: { duration: Math.max(1, Math.ceil(totalSeconds(ctx.animation.timing))), keyframeTimes: whole ? times : undefined, shots: undefined, multiShot: undefined, numOutputs: 1 },+ };+ }const times = frameTimes(frames.map((f) => f.at), ctx.duration);const kept = frames.map((f, i) => ({ ref: f.value.ref, time: times[i] })).filter((f) => !!f.ref);const sent = framesInputs(kept.map((f) => f.ref), kept.map((f) => f.time), ctx.support);@@ -771,7 +783,13 @@ export function acceptedKinds(slots: InputSlot[], multiRef?: { kind?: MediaKind// Hand-off params ("/video?image=…") arriving after the first paint/** The URL params a studio prefills its draft from; anything else in the query is ignored. */-export const HANDOFF_PARAMS = ["image", "ref", "video", "audio", "prompt", "preset", "model", "format", "resolution"] as const;+export const HANDOFF_PARAMS = ["image", "ref", "video", "audio", "prompt", "preset", "model", "format", "resolution", "frames"] as const;++/** Most frames a hand-off opens Frames mode with ("/video?frames=a,b,c": Storyboard's panels, a Character Sheet's poses). */+export const HANDOFF_FRAMES = 10;+/** The stills a "frames" hand-off names, in order (file URLs, comma-separated). */+export const handoffFrames = (v: string | null | undefined): string[] =>+ (v ?? "").split(",").map((x) => x.trim()).filter((x) => /^(\/api\/files\/|https:\/\/)/.test(x)).slice(0, HANDOFF_FRAMES);/** A stable key for the hand-off part of a query string ("" when there's none). */export function handoffKey(search: string | URLSearchParams | null | undefined): string {@@ -795,6 +813,8 @@ export interface DraftShape {presetOptions: Record<string, string>;presetStrength?: number;mix?: { presetId: string; strength: number };+ /** Frames mode's stills (Video studio). */+ frames?: FrameAttachment[];}const same = (a: unknown, b: unknown) => a === b || JSON.stringify(a ?? null) === JSON.stringify(b ?? null);@@ -1038,6 +1058,9 @@ export function mergeHandoff<D extends DraftShape>(base: D, current: D, next: D)if (slotsChanged) patch.slots = slots as D["slots"];const refsUntouched = current.refs === base.refs || (current.refs.length === base.refs.length && current.refs.every((r, i) => sameAttachment(r, base.refs[i])));if (refsUntouched && (next.refs.length || current.refs.length)) patch.refs = next.refs as D["refs"];+ // Frames handed over (Storyboard's "Animate these panels") open Frames mode, unless the strip was changed already.+ const framesKey = (d: D) => d.frames?.map((f) => f.value.ref);+ if (next.frames?.length && same(framesKey(current), framesKey(base))) patch.frames = next.frames as D["frames"];const preset = (d: D) => [d.presetId, d.presetOptions, d.presetStrength, d.mix];if (same(preset(current), preset(base)) && !same(preset(current), preset(next))) {patch.presetId = next.presetId;diff --git a/src/lib/inbetween.ts b/src/lib/inbetween.tsindex e0be34f8..2bf944f5 100644--- a/src/lib/inbetween.ts+++ b/src/lib/inbetween.ts@@ -222,3 +222,16 @@ export function requestTiming(extra: Record<string, unknown> | undefined, keys:export function gapPrompt(base: string | undefined, gap: Pick<GapTiming, "prompt">, stillMouth: boolean): string {return [base?.trim().replace(/[.\s]+$/, ""), gap.prompt?.trim().replace(/[.\s]+$/, ""), stillMouth ? STILL_MOUTH_PROMPT : ""].filter(Boolean).join(". ");}++/** Fuobe Animation's model id. */+export const ANIMATION_MODEL = "fuobe-animation";++/**+ * The Video studio in Frames mode with these stills as keyframes, in Animation style (Storyboard's "Animate these panels",+ * a Character Sheet's "Animate between poses"): /video?model=fuobe-animation&frames=a,b,c&prompt=….+ */+export function animateHref(stills: string[], prompt?: string): string {+ const q = new URLSearchParams({ model: ANIMATION_MODEL, frames: stills.slice(0, MAX_KEYS).join(",") });+ if (prompt?.trim()) q.set("prompt", prompt.trim());+ return `/video?${q.toString()}`;+}