A composition's sound ran on the audio clock while its picture ran on
the frames. A frame counts at most 0.1 s, so after a hitch the sound
stayed ahead of the picture until the next stop. Songs in a trailer
drifted off the cut. The items of a composition also had no bus of
their own, and a video sprite could not pick where its sound goes.
- CompositionSound.follow compares the audio clock with the picture
each frame. More than 40 ms apart, it starts the sound again where
the picture is. This holds in the tab and in a run.
- A time scale other than 1 now restarts the sound again and again.
It stays in time but comes in pieces.
- The sprite of a video item shows "Driven (by composition)" as a
fixed Video clock row. Video time is hidden there, because the
composition sets it every frame.
- Every composition has a bus in the mix and a node in the master
routing. A new one goes to the master unless other compositions are
linked elsewhere, apart from where the sounds go.
- Audio items pick From asset, To composition, Master or a bus. New
items start with To composition. Items saved before keep From asset,
so music already sent through a bus does not bypass it.
- Video sprites have a new row Video bus: From asset by default, the
master or a bus. In a composition the default is the composition's
bus, also for video sprites inside a container item.
- The chosen bus is part of the key of the video player, so a sprite
with another bus gets a player of its own.
Found along the way:
- Six tests with full lists of sprite defaults expected the old rows
and now list Video bus too.
Tests:
- tsc, eslint, Prettier clean
- Unit: 971 green in the 28 files touched
- npm run check on melektaus-atx: green, 309 files, 4804 tests
- e2e 68 (melektaus-atx): 13 checks green, 68i new. The sound item
and the video item go into mix:cp68-cut, which goes to the master.
- e2e 69 (melektaus-atx): ALL PASSED, 23 checks, 69q and 69r new.
After a hitch of 500 ms the sound restarted twice and then lay
0.5 to 5 ms off the playhead.
- Counter-checks in unit tests: without the comparison the hitch test
fails, without the bus in the preload the run test fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A trailer needs its music and its clips to come in softly and leave
softly. Until now an item of a composition could only play at one
level, and a video item could not even be turned down on its own.
- Every item with sound gets a grip at its upper left and upper right
corner. Dragging one inwards fades the item in or out. Dragging it
back to the edge removes the fade. Lower down the same edge still
trims as before.
- The fade is drawn as its curve, with the part above it darkened.
The inspector shows Fade in and Fade out in seconds, each with the
curves sound clips already know.
- The model keeps fadeIn and fadeOut in frames plus curveIn and
curveOut on the item. Old projects load unchanged. An item shorter
than its fades plays them cut to its length but keeps the setting.
- Sound, pattern and song items ramp the gain of their own bus. The
scheduler plans the ramps on the audio clock next to the notes.
Starting in the middle of a fade picks it up from there.
- Video items set the new sprite property Video volume each frame.
It multiplies with the fade and is only shown for a driven video.
The player glides to each new level over 15 ms so it does not click
between frames.
Not covered: a container item that carries a video further down gets
no grips. Only a video on the item's own sprite counts.
Tests:
- tsc, eslint, Prettier clean.
- Unit tests for composition, music, song and sound (12 files): 269
passed, 7 of them new.
- e2e 69 on melektaus-atx: ALL PASSED, 21 checks. 69p drags a grip to
a fade in of 10 frames and hears the item bus rise from 0.127 over
0.229 and 0.339 to 1 within one second.
- Counter-checks as unit tests: without the audio ramps, and without
the level on the video sprite in the game, both go red.
- Gate on melektaus-atx: 309 files, 4796 tests passed, 8 more than
at 77ac9d1. The first run failed 14 tests in 6 files that list the
default sprite properties or the bus levels in full. They now
expect videoVolume and the new level field of busLevels.
- Not tried in a browser: video fades, pattern and song items with a
fade.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An object that appears during a frame and plays an animation in its
On start was drawn once in its original state. A composition item
showed frame 0 one frame late. An object from the Spawn node even ran
its On start only on the next frame, after it had been drawn.
- BehaviorSystem: at the end of the behavior pass, objects that came
to be in this frame hear On start and On enable. This covers spawned
objects and behaviors switched on for the first time. Their
On update starts with the next frame.
- AnimationSystem.showStarted: right after that, every animation
started in this frame shows its frame 0. The clock runs from the next
frame, and an end is told no earlier than then. A paused frame skips
this, its animations stand still anyway.
- What such a late On start spawns in turn starts in the next frame.
Otherwise a spawn chain could stretch one frame without end.
- Scene start is unchanged. There On start already ran before the
first frame.
- Wiki Behaviors, Lifecycle: the new timing.
Tests: gate green on stein2 (melektaus-atx went offline mid-run),
305 files, 4716 tests (2 new). e2e 68 on melektaus-atx green,
10 checks. Without the late pass the Spawn test
reads 7 instead of 0, without showStarted both new tests are red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A composition lost the first frames of a video item. Its clock ran
while the player was still loading, in the tab and in the game. The
game only waited for videos once, when it started. A composition that
a behavior starts later spawned its items after that wait.
- The view now records which video sprites it left out for lack of a
first picture, one entry per object.
- The composition tab holds its playhead while the preview misses a
video, for at most VIDEO_WAIT_MS (3 s) like the game.
- CompositionSystem holds a composition's clock while one of its live
items misses its video. The rest of the game keeps running.
- The editor play and the published game pass their view to the run
as RunServices.pictures.
- VIDEO_WAIT_MS moves to core/model/video.ts, because the runtime
does not import from viewport/.
- Videos loaded ahead for coming items do not hold the clock.
Items can now be copied and pasted inside the composition tab.
- Ctrl+C keeps the timing of the copied items next to the objects.
- Ctrl+V pastes objects and items in one undo step. The earliest item
lands at the frame under the pointer, on the track there.
- Without the pointer over the tracks it lands at the playhead, on the
selected track or on the top track of the selected items.
- Several items keep their distances and tracks to each other.
- The same copy pastes into a scene as plain objects. Objects copied
from a scene do not paste into a composition, they have no timing.
Tests:
- Unit composition-edit, clipboard, composition-play: 3 new for
pasting, 1 new for the clock waiting in the game
- e2e 69i (play from the end waits for the video), 69j (paste under
the pointer and at the playhead), 68d (a composition started from
On start waits for its video)
- each new check is red without its fix
- README: 2036 editor checks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two sprites with videos back to back left a blank frame at the cut.
The video player only came into being once the item began, and a
sprite is not drawn until its video has a first frame. So the second
item was missing until its video had loaded.
- compositionAhead lists the items that begin within the next second.
Near the end of a looping composition it also lists the items at
its start.
- An item that is alive already is not loaded ahead. Two times would
otherwise pull at the same player.
- The frame carries these videos hidden and paused on their first
picture at the item's offset. Their players get the id the item
will have, so the cut reuses them instead of opening a second one.
- This works the same in the tab's preview and in the game.
- One second of lead (AHEAD_SECONDS) is an assumption. It can go up
if large videos still flash.
Tests:
- Unit composition: 27 green, 2 new. Unit composition-play: 14
green, 1 new for the path in the game.
- e2e 69: ALL PASSED, 12 checks. The new 69h puts two video items
back to back and checks the second player is open and paused at
its offset before the cut, and drawn in the same redraw as the
cut.
- Without loading ahead in the preview 69h fails with cut: null.
Bending two spots in the model turned their unit tests red.
- Gate on melektaus-atx: CHECK EXIT 0, 302 files, 4665 tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A composition can now sit in a scene like a container and play there.
Its items become real objects while they run, so behaviors, colliders
and events work on them as on any other object.
- A composition is placeable with its own symbol, transform and render
layer. The scene view shows its picture at frame 0. A click on that
picture selects the placement, not a single item.
- CompositionSystem spawns each item as an object under the placement
when it begins, with the id <placement>~<item>. On start and the
other events run. The object is destroyed when the item ends.
- The top track lies in front no matter which item started first.
World.arrange() orders the entity list and the scene objects.
- Clips and driven videos follow the same rules as compositionAt().
Loop, restart, stop and the game pause work.
- New nodes: Play composition (with restart), Stop composition and the
event On composition finished. They were planned for step 4 but come
now, because without autoplay nothing could play otherwise.
- The editor run ignores Play composition and says so in the log. It
writes into the saved project, and the items would stay behind.
- contentId() moved to instance.ts. The animation system uses it for
nested ids too.
- Compositions get no "Sort with parent" for now.
Tests: the gate passed with 301 files and 4643 tests, 18 more than
step 1. 13 of them are in tests/core/composition-play.test.ts. The
first gate run failed in event-order.test.ts, which counts the event
nodes and now finds 19. Five counter-checks each turned exactly their
test red. Two order tests stayed green without the fix at first and
were rebuilt. e2e 68 is new and passed with 5 own checks. Its
counter-check without arrange() failed as expected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>