Skip to content

morpho: build from scratch, timing, layout notes, video and fit - #21

Merged
srivtx merged 2 commits into
mainfrom
ai-tools-2
Oct 23, 2026
Merged

srivtx merged 2 commits into
mainfrom
ai-tools-2

Conversation

@srivtx

@srivtx srivtx commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Stacked on #20 (base ai-tools). Merge #20 first, then retarget this to main.

I made a poster with nothing but morpho and fixed each place I got stuck. The first round could tweak a design but not make one, couldn't show timing, didn't judge layout, and had no video export.

New commands

Command What it does
new A blank design. --canvas 1080x1350 or a preset name, --bg as a colour, gradient or preset, --duration.
add text, shape, line or path, with --name --at --size --font --color --material or --preset, --recipe, and --above, --below or --into for placement. Also add modifier <kind> --to L [--fields], add group A B [--merge], add font f.ttf (embeds it and prints the id for --font), and add image p.png [--to L].
remove, duplicate, arrange duplicate gives the copy new ids and moves its modifier keyframes to the new uids.
set Layer.preset="…", Layer.recipe=… Presets and recipes in any assignment.
align Lines layers up by what they draw, not their anchors: a wavy word that looks 6 px off centre gets centred by its ink.
timing Entrances and exits as bars on the clock; loops and keyframes as their cycles, with hold keyframes shown as rest, go, at To, back. Notes on rhythm: entrances all starting at once, long stretches where nothing moves, moves cut off by the clock.
layout Every layer's box, centre and margins as text.
video MP4, MOV, WebM or GIF through ffmpeg, or PNG frames. Every frame is drawn at its exact time, so a 4 s loop exports in about 3 s and joins seamlessly.
fit Tunes settings until the design matches a reference picture. On a test where the title was secretly resized to 265 and moved to y −190, it found 265.2 and −188.9.

New layout notes, in check and layout:

  • edges and centres that nearly line up (0.2–1.2% of the canvas apart)
  • layers that are nearly centred
  • things crowding an edge
  • a design sitting a little off centre
  • no clear lead between headlines
  • too many text sizes
  • where the visual weight sits, and how many hues the palette uses

Fixes found by using it

  • Changing a loop or entrance kind now also sets that kind's default amount. Before, switching the loop to spin kept the generic 16, which meant 16 turns.
  • Motion pops are judged against the frame steps either side, so a fast but smooth entrance no longer reads as a jump. The loop seam is judged against the step before it, so an entrance that replays every loop is caught.
  • Embedded fonts survive the reloads that images, align and fit do.
  • Visual weight is measured from pixel centres. An off-by-half-pixel error had made centred things read as "upper".
  • The layout notes ignore 1–2 px differences between text boxes (from glyph shapes) and single letters that make up a word (the "2" and "K" in Y2K).

The poster, made with the tools

docs/AGENT-TOOLS.md has the full sequence; it runs as written.

  • The first check said the title was 10% off both edges and that the loop jumped, because the entrance replayed.
  • After set (smaller title, fade out at 3.3 s) and align, check reported no problems and a smooth loop join.
  • video then exported a 120-frame MP4 in 2.6 s.

Tests

  • 12 new unit tests (126 in all).
  • New end-to-end checks for layout, the palette, video frame batches and align (112 checks in all).
  • npx tsc --noEmit -p ui, npx vitest run and npm run build && npm run test:e2e pass locally. I ran the e2e test with CHROMIUM_PATH set to Chrome.

🤖 Generated with Claude Code

srivtx and others added 2 commits October 24, 2026 01:50
From making a poster with nothing but morpho, the gaps were: adding
things, seeing when things move, judging layout, exporting video, and
matching a reference without guessing. Now:

- new / add (text, shape, line, path, modifier, group, font, image) /
  remove / duplicate / arrange, with presets, recipes and placement;
  Layer.preset= and Layer.recipe= work in any assignment
- align: lines layers up by what they draw, not their anchors
- timing: entrances, exits, loops and keyframes as bars on the clock,
  with notes on rhythm (all at once, dead air, cut off by the clock)
- layout, and in check: boxes and margins, near-miss edges, nearly
  centred, crowded edges, no clear lead, visual weight and palette
- video: MP4, WebM, GIF or PNG frames, drawn frame by frame and piped
  to ffmpeg (a 4 s loop exports in about 3 s)
- fit: tunes settings until the design matches a reference picture

Fixes found on the way: a new loop or entrance kind takes its own
default amount (spin was 16 turns); motion pops are judged against the
frames either side, so fast smooth moves aren't flagged; loop seams
against the frame before; embedded fonts survive reloads; weight is
measured from pixel centres.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
morphotype Ready Ready Preview Oct 23, 2026 8:20pm UTC

@srivtx
srivtx changed the base branch from ai-tools to main October 23, 2026 20:21
@srivtx
srivtx merged commit 22c5462 into main Oct 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant