writing / post19 nov 2026

Motion you can measure

I have a script that turns every screen change of Durandal into four numbers; it found four faults on its first day, and later it put a price on a change.

this post

published
2026-11-19
reading
07 min
parts
7
the exhibit: ~ / work / durandal

Squinting at a phone

Tuning motion by hand on a phone is slow. You tap, you squint, you say "hmm, a bit faster", you rebuild. I'd rather read a number.

So on 3 November 2026 Durandal, my iPhone training coach, got a script that does the squinting for it. Claude wrote it for itself. Personal software, again names the script and gives one number from it. This Post is the rest: how it works, and what its numbers showed.

The script turns each change of screen into four numbers: when the motion starts, where the cut lands, when the screen is still again, and how many frames were dropped. The cut is the moment the old screen is replaced by the new one. The first three numbers are in milliseconds from the start of a step. The fourth is a count.

The same walk, every time

To compare two versions of an animation, the two runs have to do the same things. So the app has a tour: a fixed list of steps that it walks by itself, 1.5 seconds apart. Today the list has 16 steps.

the 16 steps of the tourtext
train · train.lifts · train.log · body · body.scroll · body.vitals
body.sleep · coach · today · today.scroll · push.sources
push.motionLab · sheet.open · sheet.close · pop · pop

At each step the app prints a line with the step's name and the time. The tour exists only in the simulator build, and that build has two switches. One starts the tour. The other opens the app offline, and the source says what that means: it never reaches Hevy, Health or Claude.

The script builds the app, starts it with both switches, and records the simulator's screen as a video.

Video in, four numbers out

Now the video and the lines of the tour have to meet on one clock. The simulator shares the clock of the Mac. The script stamps the moment the recording starts with it, the app stamps each step with it, and the difference is where each step sits inside the video.

Then a small program in Swift reads the video frame by frame:

  • It makes a grey copy of each frame at a sixth of its size. A code comment gives the reason for the size: enough to see a component move 6 points.
  • It leaves out the top 13 percent of the screen, where a cursor blinks by itself.
  • It compares each copy with the one before, and keeps one number: the mean change of a pixel, on a scale to 255.
  • A frame with a change over 0.05 counts as motion.

The report is 59 lines of Python. For each step of the tour it takes the frames that moved, and reads the four numbers from them:

Where the four numbers come from
NumberHow it is found
startthe first frame that moved
cutthe frame with the largest change
settlethe last frame that moved before 200 ms with no motion
hitchesthe gaps of more than 25 ms between two frames while the motion runs

The last row leans on a quirk of the simulator that a code comment records: it records only the frames that changed. The report takes a frame as a sixtieth of a second, about 17 ms. So a gap of more than 25 ms in the middle of a motion is a frame that didn't come.

For each burst of motion the program also saves a contact sheet: every second frame, side by side, in one picture.

Four faults on day one

The script came in with one merged change, a pull request of several commits. The last part of that pull request used the script on the app. Its message starts: "Measured with the motion loop, the swap had four faults." The swap is the change from one screen to the next.

  1. A new screen showed empty boxes. The tile frames (the boxes, not the frames of the video) and the headings cut in at once, and their content entered about 225 ms later.
  2. The order was the order in the code, not the order on the screen. The message has the example: the rate tiles entered before the trend chart above them.
  3. A tile inside a panel entered twice.
  4. The exit of the old screen took 180 ms, and it read as a pause before the cut.

Four faults on a first run is a good sign for a script like this.

The fix changed the order to one wave, from the top of the screen to the bottom, and shortened the exit to 100 ms. Then the script ran again. The tour had 14 steps at that time.

The first measure, over the tour
Over the tourBeforeAfter
settle, median628 ms524 ms
settle, worst765 ms687 ms
cut165 ms121 ms

The same message says what was left, and what was tried against it. What's left is 100 to 170 ms that the main thread needs to build the new screen at the cut. Building the screen at the tap was tried, and it made the tap itself lag, by 80 to 230 ms. So that's not used.

The rule with curves in it

The app has a rule for motion, in its design document: it moves in whole steps of 40 ms, with no smooth curve, and a screen changes with a cut.

The same pull request has changes that went against that rule. In the order of its message, they come before the script. A rule with exceptions before the script even ran.

One is the screen change of that time, a wipe in three steps of 40 ms. The message gives the reason in one sentence: "Three 40 ms steps read as lag on a 120 Hz screen". So the wipe ran at the rate of the display, with a curve that slows at the end. A later part of the same pull request removed the wipe.

Another is the sheet that comes up from the bottom edge. It had four steps. "On the phone that read as a low-fps slide." It got the same kind of curve, over 280 ms.

Both sentences say "read as". The second one names the phone, the first only the screen, and the message doesn't say who looked. The design document has the exception in its list of rules now: moves are stepped, and the only curve is the ease-out on a feed, sheet or entering component.

Later that evening

A second change came later the same evening. Its message calls it micro motion for screens, scrolling, components and rows: rows that come in one after another, values that count up, titles that type. It also added two steps to the tour. The message ends with the measure, against the start of that work:

The second measure, over the tour
Over the tourBeforeAfter
settle, median494 ms476 to 572 ms
dropped frames4950 to 55
the longest screensabout 650 ms800 to 960 ms

The message calls the median "about the same". The longest screens settle later, and the message says why: their rows now cascade.

Rows that come in one after another have a price, and now the price has a number. The change is in the app today. Is it worth it? I don't know yet.

What I can't tell you yet

  • A simulator can differ from a phone. The README says what the script is for: timings can be tuned without the phone in hand. No source compares its numbers with a measure on a phone.
  • The numbers move between runs. The second table has ranges. The number in the published Post, a median settle of 546 ms, is from one run.
  • The two tables don't compare. The first is from a tour of 14 steps, and the message of the second doesn't say which tour its "before" is from.
  • The build matters. The script has a switch for an optimized build, with a comment that the normal one builds its views more slowly. The commit messages don't say which build their numbers are from.
  • The data is real, and stays on the Mac. The script copies the app's data from the phone into a folder that Git ignores. The README says that it holds health data, and that it and the recordings stay on the Mac. Nothing from it is in this Post.

So that's the state of it: four numbers, a few caveats, and a script that grades homework it wrote for itself. Each time it runs, the tour walks its 16 steps, 1.5 seconds apart, with the script watching and nobody squinting at a phone.