A week of UberScene: an editor you can key in, masks, effects and motion blur
Last week's posts ended with time made exact. This week was about what you see and touch. The editor learned keys. A mask, a blend and grain work on any layer. Thirteen effects landed. The preview shows motion blur. Underneath, every kind of element became a typed module, and an edit costs a fraction of what it did.
Here is the story, theme by theme. The full list of changes is at the end.
The editor learned keys
The sdk has had key actions for a while: key/add, key/move, key/update, key/remove. The shadcn editor never called them, so a key could only be written in the file. Now the timeline shows them (#307). Under the selected bar there's one lane per keyed value, with a diamond per key:
- Drag a diamond to move the key. It lands on a frame.
- Press + on a lane to add a key at the playhead. The key holds the value the picture shows there, so nothing jumps.
- Pick a key to change its value and easing in the inspector, or press Delete to remove it. Delete takes the key, not the element.
- A value a generator moves (a wiggle, a drift) shows as a dashed lane, and its params can be edited too.
Then the picture itself became editable (#309). The selected overlay gets a frame where it's drawn, turned and scaled and under its camera. Drag inside the frame to move it, drag a corner to scale it, and drag the grip above it to turn it. Shift keeps one axis or snaps to 15°. With Auto-key on (the toggle above the picture, or K), a drag writes a key at the playhead instead of a constant. A value that already has keys is always keyed. One drag is one undo, and Escape cancels it.
Bars got their footage too (#308). Video and image bars show a filmstrip of the stretch they play, and bars with sound show a waveform. Both go through the player's own source-time math, so a trim, a slip, a speed change or a freeze changes the strip exactly as it changes playback. Waveforms come from the summary uberscene add writes into the manifest, so most files decode nothing to draw them.
Masks take keys now (more on that below), and the timeline shows them: under the element, a lane per keyed value of each of its masks, m1 · opacity, with the same gestures as every other lane (#316).
Every gesture writes one edit back to the file. That's the point of the editor: the Source tab shows the one value you dragged, changed in place. The editor's own tests check that the gestures and a fresh sdk replaying the same actions write the same file. Try the editor →
Masks, blends and grain on any layer
Until this week, blend on a title, shape, SVG, sticker or layer only drew as normal. A <Mask> only worked on clips and nested scenes, and vignette and grain only on footage. Overlays live on the DOM plane, and CSS blend modes never reach the canvas beneath it.
Now an overlay that needs any of these is drawn into its track's canvas (#312). Its DOM stays laid out underneath, so selection and the editor's handles still work. The canvas copy gets what footage gets: blend modes, feathered masks, vignette, grain.
Then masks grew up (#314). Only an element's first mask used to draw, and every mask value was a constant. Now an element takes several, joined in file order as in After Effects, and a mask's values take keys:
<Title id="tag" start={0} duration={3}>
Masks take keys
<Mask id="m1" shape={{ ellipse: { cx: 0.5, cy: 0.5, rx: 0.4, ry: 0.4 } }} />
<Mask id="m2" mode="subtract" shape={{ rect: { x: 0, y: 0.45, width: 1, height: 0.1 } }} feather={8} />
<Mask id="m3" mode="intersect" shape={{ rect: { x: 0, y: 0, width: 1, height: 1 } }}
opacity={[{ at: 0, value: 0 }, { at: 0.5, value: 1 }]} />
</Title>modeisadd(the default),subtractorintersect. The area starts empty when the first mask adds, and full when it subtracts or intersects. So a loneintersectshows its region, and a lonesubtractshows everything else.- Keys go on a drawn mask's
path.points, itsfeatherand itsopacity. Points blend point by point and handle by handle, so an outline morphs into another with as many points.
Thirteen effects
The first batch of new effects landed (#311). Each one is keyable, has a set of params that changes nothing, and comes with a reference page, a preview and a golden still. Each works on a clip and through an <Adjustment>.
| Family | Effects |
|---|---|
| Blur | directionalBlur, bokehBlur |
| Distort | ripple, twirl, bulge, waveWarp, displacementMap, mirror, kaleidoscope |
| Stylize | posterize, emboss, findEdges, tiles |
<Clip id="shot" src="asset:redCup" effects={[{
type: "twirl",
radius: 220,
angle: [{ at: 0.5, value: 0, easing: "easeInOut" }, { at: 1.5, value: 180 }],
}]} />echo was left out on purpose. It needs earlier frames, and a shader only gets the time. Frame history will be its own change.
Motion blur in the preview
motionBlur on the <Composition> used to be export only. You judged a fast move on a sharp picture, then exported to see it blurred. Now the preview blurs too (#315):
<Composition fps={30} width={1920} height={1080} motionBlur={{ shutterAngle: 180, samples: 8 }}>- Paused, the frame is blurred by the export's own code, with the same shutter times and samples, so it equals the exported still.
- Playing, it blends up to three shutter times from frames already decoded. That costs no extra decodes.
- Off:
previewMotionBlur={false}on the player, or the aperture toggle in the editor's transport.
Shapes and scenes
Bezier paths on
<Shape>(#301). A point may havehandleInandhandleOut, the same point a drawn mask uses, andclosedjoins the last point back to the first. Keys onpointsmove the handles with the points, so a curve morphs into a curve. A new lint,morph-point-count, warns when two keys have different numbers of points.A nested scene that loops (#302). A walk cycle, a pulse or drifting dust can repeat as a whole, in CSS's animation words:
tsx<Track id="loops"> <Nested id="walk" of={WalkCycle} duration={6} loop /> {/* repeats for 6 s */} <Nested id="pulse" of={Pulse} duration={4} loop={{ direction: "alternate" }} /> {/* forward, back, forward… */} <Nested id="dust" of={Dust} loop={{ iterationCount: 4, direction: "alternateReverse" }} /> {/* four passes */} </Track>One spelling for looping (#304). The
loopgenerator on a value now takes the samedirectionanditerationCount. Its oldmodeis gone:"pingpong"is nowdirection: "alternate", and the schema error says so.Titles inside a nested scene draw (#303). Overlays in a
<Nested>were never drawn, in the preview or the export. We found this while building the loop.
Under the hood
Exact time, finished. The resolver, the edits and inspect now do all their time math with Time methods (#277). TypeScript lets < and === through on two objects, so a new pnpm lint:time walks the type checker and fails on any operator that takes a Time. It found 17 compares in the sdk, one of them in the resolver's transition fit. Then a placement's old start, end and duration seconds went away (#278). p.range is the only time a placement has. That's a breaking change for sdk users, and the changeset says how to migrate.
A kind is a typed folder, and a reference is a graph edge. Adding a new kind of element used to touch 25 to 54 files, because about 330 places asked an element's kind by name (decision 0046). Now each kind is a closed type with typed props and one folder of the same name in each package (#279, #293). Every reference one element makes to another (an anchor, a follow, a camera's push) is an edge of one graph, read from the props the schema marks. That made prop links cheap to build. In place of any number that changes over time, a value can read another element's:
<Shape id="gear" ... transform={{ rotation: { link: "dial.transform.rotation", scale: -2 } }} />
<Shape id="late" ... transform={{ rotation: { link: "dial.transform.rotation", delay: 0.4 } }} />See A value linked to another. The sdk's hundred-odd action handlers became one typed table too (#306), so a missing or misnamed handler now fails the build instead of failing at run time.
A cheaper edit. One edit while dragging (validate, invert, patch, resolve) went to about a third to a sixth of its cost (#288). The resolver now keeps what an edit didn't reach, and a test holds every cached resolve equal to one worked out from nothing. Trimming a clip in a 1,000-clip project went from 2.4 ms to 0.67 ms on the fastest batch. The typed modules gave some of that back, and #296 won it back again.
Edits that only show where they work. The sdk tells a tool which edits each element can take. Some were offered on elements whose schema had no place for them, then refused when run. Each is now offered only where it can work (#292, #295). There's a new ripple trim as well, clip/rippleTrim, which shifts everything after a trimmed element by the change (#294).
Exports. uberscene queue jobs.json exports several videos in order from one file. Every job is checked before the first one renders, and you get one summary at the end (#269). Native encoder frames are now sent as a Blob, which keeps Chrome from copying each 8 MB frame into DevTools events. On one 600-frame 1080p benchmark, export time fell from 146 s to 17 s (#280). Decision 0047 keeps craft-libs as the codec layer and lays out three measured steps toward native decode by default.
Films made from code
Each example below is one file with its own scripts. The footage and sound are fetched, never committed.
- Orbit: Earth at night from the space station, cut to 16 bars at 120 BPM. Every lightning strike lands on a snare.
- Liftoff: sixty years of launches, Apollo to Starship, with shots that start on measured ignitions.
- Machine: a music machine with no footage. Each voice of a Strudel score has a lane, and every note lands on the strike line as it sounds.
- Nature: nature and skiing, with every sound laid in code (#266).
- THE SWELL, an ocean film cut to deep house at 125 BPM. LIFTOFF again as an up/down split screen that ends on the tower catch. And a raw-vs-edit reel that plays a podcast as shot beside the short cut from it (#313).
The films needed engine pieces, and those shipped with them: Strudel scores rendered to sound, uberscene sound (a seeded sound kit that gives the same bytes on every machine), <Audio align="onset"> to place a sound by its attack, and <TimelineView>, which draws a film's own timeline under it for sound-breakdown posts.
The changelog
Every pull request merged from November 27 to December 3, after the blog opened.
Editor
- #307 A keyframe lane in the timeline: move, add, edit and remove keys; generators as dashed lanes.
- #308 Filmstrips and waveforms on timeline bars.
- #309 On-canvas transform handles with auto-key.
- #310 One player engine alias in the demo app's Vite config.
- #316 A selected element's mask keys on the timeline.
Player
- #303 Overlays inside a nested scene are drawn.
- #312 Blends, masks, vignette and grain on overlays.
- #314 Several masks per element, and keyed masks.
- #315 Motion blur in the preview.
Kit
- #301 Bezier paths on
<Shape>, and themorph-point-countlint. - #302
loopon a nested scene. - #304 The
loopgenerator takesdirectionanditerationCount(breaking:modeis removed). - #311 Effects batch 1: blurs, distortions and stylizers.
SDK and engine
- #277 Edit and inspect math on
Timemethods, withpnpm lint:time. - #278 A placement's times are only its range (breaking).
- #279 A kind is a typed folder in each package, a reference is a graph edge, and prop links.
- #288 A much cheaper edit step.
- #292
clip/setAnchoris offered only where it can work, and keeps the element where it was. - #293 The other twenty kinds as typed modules.
- #294 Ripple trim,
clip/rippleTrim. - #295 Edits are offered only on elements they can change.
- #296 The edit step won back, and
Placementas a typed union (breaking for sdk types). - #306 The action handlers as one typed table.
Render
- #269
uberscene queue: several exports from one jobs file. - #280 Native frame uploads kept out of DevTools.
Examples and docs