summaryrefslogtreecommitdiff
path: root/anim/tools/chart.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 14:48:26 -0300
committerGabriel Schneider <[email protected]>2026-11-10 15:14:31 -0300
commit7e9bf9e6e85c6c6e7a400d4fa0b43b77133ed3cb (patch)
treea6add92cd4dcbbf4c31cd1ce989d99b190258353 /anim/tools/chart.py
parented46c51fe127377eb1fde8dee83da984e0f61860 (diff)
downloadcomputeranim-7e9bf9e6e85c6c6e7a400d4fa0b43b77133ed3cb.tar.gz
computeranim-7e9bf9e6e85c6c6e7a400d4fa0b43b77133ed3cb.zip
canim: animations of recordings, as a debugger's whole context with a lens beside it
A package of its own (anim/), on sketchbook's anim module and pardes's syntax. A scene opens a recording, takes a cursor into it, and declares blocks that read the moment the cursor is at: the state column (registers each followed as a pointer and inked by where it points, the stack telescope, the backtrace), the program column (the whole source, the disassembly in address order, and the scene's lens: a node-link list over a hexdump of its heap, array cells, a call tree, a syscall crossing), and ties between them. Motion is a step told as a sentence (the line fires, its effects cascade a level at a time, the mark moves on last), timed by what the step contains; walk, hurry and sprint pace a loop. Five scenes from real recordings of fib, a linked list, a sort and syscalls. First drafts, by the agent's own handover: the frame of the design's second revision, the hexdump lens and the ties; no disassembly annotations, no gallery, scenes not yet reviewed against the mocks.
Diffstat (limited to 'anim/tools/chart.py')
-rw-r--r--anim/tools/chart.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/anim/tools/chart.py b/anim/tools/chart.py
new file mode 100644
index 0000000..ca783dc
--- /dev/null
+++ b/anim/tools/chart.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+"""The designer's motion instrument (design/motion/motion.py: timing chart,
+five rule checks, contact sheets), told where canim's panels are now.
+
+ chart.py chart|auto|sheet|onion|track VIDEO ... as motion.py takes them
+
+The video's file name (fib-1080.mp4 -> fib) picks its regions.
+"""
+import os, sys
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "design", "motion"))
+import motion
+
+W = motion.W
+# theme.layout (design revision 2): the state column is the same in every scene; the program
+# column is shared by the scene's split (lens, source, disassembly). The clock is over the caption.
+def panel(rows):
+ return 36 + 24 * rows
+
+def split(lens, source, disasm):
+ y = 48 + (lens + 12 if lens else 0)
+ out = {"lens": (64, 48, 880, lens)} if lens else {}
+ out["source"] = (64, y, 880, panel(source))
+ out["disasm"] = (64, y + panel(source) + 12, 880, panel(disasm))
+ return out
+
+# The clock is under the name the instrument gives to words that are not panels ("head"):
+# its progress line moves with every step and must not count as a panel starting.
+state = {"head": (0, 888, W, 46), "registers": (976, 48, 880, panel(18)), "stack": (976, 528, 880, panel(8)), "backtrace": (976, 768, 880, panel(3))}
+CAPTION = (0, 934, W, 146)
+beside, subject, none = split(312, 8, 10), split(432, 5, 8), split(0, 14, 17)
+motion.REGIONS.update({
+ "fib": {**beside, **state, "caption": CAPTION},
+ "sort": {**beside, **state, "caption": CAPTION},
+ "syscalls": {**beside, **state, "caption": CAPTION},
+ "list": {**subject, **state, "caption": CAPTION},
+ "zoom": {**none, **state, "caption": CAPTION},
+})
+_regions_for = motion.regions_for
+motion.regions_for = lambda video, name: _regions_for(video, name or os.path.basename(video).split("-")[0].split(".")[0])
+
+if __name__ == "__main__":
+ motion.main() if hasattr(motion, "main") else sys.exit("design/motion/motion.py has no main()")