libraryextensions/blender/lib/Video.xtl

Video.xtl -- arrays to video: an animated Blender scene described by X_eTaL arrays. Every object's place, size, color, the seconds it is shown, every key it moves to, the camera's path and the captions are arrays a program works out; each function here writes them into Blender's Python as numbers, one call of the player for a whole group. The player (vd:head) is fixed Python, the same for every video: it reads the numbers and makes the objects and keys, and decides nothing. A video is vd:head, then vd:s_tage, the groups, their spans, keys and tints, the camera, the captions, then vd:r_ender (or vd:s_tills), written with bl:w_rite! and run by bp:launcher through bl:r_un!.

For explainer videos: the picture's size is any (vd:landscape, 1920 by 1080, or vd:shorts, 1080 by 1920, upright); vd:f_it places the camera so a region fills either; vd:r_etime remaps a scene's own seconds to the video's (slow motion, time-lapse); vd:g_lows keys how strongly things glow from data; vd:c_ards are title cards; captions and cards are sized to the picture and wrapped to its width; and vd:c_ues and vd:s_rt write the cue sheet and the subtitles (.srt) of the same captions, to record narration against.

The look: flat colors that glow (emission only), on a near-black sky, the Standard view (colors as given); text in JuliaMono Black (work/fonts, just font), facing the camera; captions on a dark plate near the bottom of the picture. Places are meters, z up; times are seconds; colors are 0 to 255 (sRGB), made linear here. Written for Blender 5.1. Import: "vd:" u_se< "Video"

source

The player

ʰplayBase : Char

value (private) · line 34
ʰplayBase ← ("import bpy, math, os, sys, textwrap\n" c̲at
  "args = sys.argv[sys.argv.index('--') + 1:]\n" c̲at
  "out = args[0]\n" c̲at
  "os.makedirs(out, exist_ok=True)\n" c̲at
  "bpy.ops.wm.read_factory_settings(use_empty=True)\n" c̲at
  "bpy.context.preferences.edit.keyframe_new_interpolation_type = 'BEZIER'\n" c̲at
  "scene = bpy.context.scene\n" c̲at
  "scene.render.fps = 30\n" c̲at
  "groups = {}\n" c̲at
  "rig = {}\n" c̲at
  "\n" c̲at
  "def nums(text, k):\n" c̲at
  "    v = [float(t) for t in text.split()]\n" c̲at
  "    return [tuple(v[i:i + k]) for i in range(0, len(v), k)]\n" c̲at
  "\n" c̲at
  "def frame(t):\n" c̲at
  "    return 1 + round(t * scene.render.fps)\n" c̲at
  "\n" c̲at
  "def font():\n" c̲at
  "    d = os.getcwd()\n" c̲at
  "    while True:\n" c̲at
  "        p = os.path.join(d, 'work', 'fonts', 'JuliaMono-Black.ttf')\n" c̲at
  "        if os.path.exists(p):\n" c̲at
  "            return bpy.data.fonts.load(p, check_existing=True)\n" c̲at
  "        if os.path.dirname(d) == d:\n" c̲at
  "            return None\n" c̲at
  "        d = os.path.dirname(d)\n" c̲at
  "\n" c̲at
  "FONT = font()\n" c̲at
  "ADVANCE = 0.33\n" c̲at
  "\n" c̲at
  "def glow(name, rgb, strength=1.0, alpha=1.0):\n" c̲at
  "    m = bpy.data.materials.new(name)\n" c̲at
  "    m.use_nodes = True\n" c̲at
  "    nt = m.node_tree\n" c̲at
  "    for n in list(nt.nodes):\n" c̲at
  "        nt.nodes.remove(n)\n" c̲at
  "    e = nt.nodes.new('ShaderNodeEmission')\n" c̲at
  "    e.name = 'glow'\n" c̲at
  "    e.inputs['Color'].default_value = tuple(rgb) + (1.0,)\n" c̲at
  "    e.inputs['Strength'].default_value = strength\n" c̲at
  "    o = nt.nodes.new('ShaderNodeOutputMaterial')\n" c̲at
  "    if alpha < 1.0:\n" c̲at
  "        tr = nt.nodes.new('ShaderNodeBsdfTransparent')\n" c̲at
  "        mx = nt.nodes.new('ShaderNodeMixShader')\n" c̲at
  "        mx.inputs[0].default_value = alpha\n" c̲at
  "        nt.links.new(tr.outputs[0], mx.inputs[1])\n" c̲at
  "        nt.links.new(e.outputs[0], mx.inputs[2])\n" c̲at
  "        nt.links.new(mx.outputs[0], o.inputs[0])\n" c̲at
  "        m.surface_render_method = 'BLENDED'\n" c̲at
  "    else:\n" c̲at
  "        nt.links.new(e.outputs[0], o.inputs[0])\n" c̲at
  "    return m\n" c̲at
  "\n")
Used in: ˡhead

ʰplayStage : Char

value (private) · line 90
ʰplayStage ← ("def stage(w, h, fps, seconds, sky, lens):\n" c̲at
  "    scene.render.engine = 'BLENDER_EEVEE'\n" c̲at
  "    scene.eevee.taa_render_samples = 16\n" c̲at
  "    scene.view_settings.view_transform = 'Standard'\n" c̲at
  "    scene.render.resolution_x, scene.render.resolution_y = int(w), int(h)\n" c̲at
  "    scene.render.resolution_percentage = 100\n" c̲at
  "    scene.render.fps = int(fps)\n" c̲at
  "    scene.frame_start, scene.frame_end = 1, frame(seconds)\n" c̲at
  "    world = bpy.data.worlds.new('sky')\n" c̲at
  "    world.use_nodes = True\n" c̲at
  "    world.node_tree.nodes['Background'].inputs['Color'].default_value = tuple(sky) + (1.0,)\n" c̲at
  "    scene.world = world\n" c̲at
  "    cam = bpy.data.objects.new('camera', bpy.data.cameras.new('camera'))\n" c̲at
  "    cam.data.lens = lens\n" c̲at
  "    cam.data.clip_start = 0.001\n" c̲at
  "    cam.data.clip_end = 5000.0\n" c̲at
  "    scene.collection.objects.link(cam)\n" c̲at
  "    scene.camera = cam\n" c̲at
  "    aim = bpy.data.objects.new('aim', None)\n" c̲at
  "    scene.collection.objects.link(aim)\n" c̲at
  "    look = cam.constraints.new('TRACK_TO')\n" c̲at
  "    look.target = aim\n" c̲at
  "    look.track_axis = 'TRACK_NEGATIVE_Z'\n" c̲at
  "    look.up_axis = 'UP_Y'\n" c̲at
  "    rig['camera'], rig['aim'] = cam, aim\n" c̲at
  "\n" c̲at
  "def cube_mesh():\n" c̲at
  "    v = [(x, y, z) for z in (-0.5, 0.5) for y in (-0.5, 0.5) for x in (-0.5, 0.5)]\n" c̲at
  "    f = [(0, 2, 3, 1), (4, 5, 7, 6), (0, 1, 5, 4), (2, 6, 7, 3), (0, 4, 6, 2), (1, 3, 7, 5)]\n" c̲at
  "    m = bpy.data.meshes.new('cube')\n" c̲at
  "    m.from_pydata(v, [], f)\n" c̲at
  "    m.update()\n" c̲at
  "    return m\n" c̲at
  "\n" c̲at
  "def boxes(name, rows, style):\n" c̲at
  "    base = cube_mesh()\n" c̲at
  "    made = []\n" c̲at
  "    for i, r in enumerate(rows):\n" c̲at
  "        n = '%s %d' % (name, i + 1)\n" c̲at
  "        o = bpy.data.objects.new(n, base.copy())\n" c̲at
  "        scene.collection.objects.link(o)\n" c̲at
  "        o.location = r[0:3]\n" c̲at
  "        o.scale = r[3:6]\n" c̲at
  "        o.data.materials.append(glow(n, r[6:9], r[9], 0.18 if style == 'glass' else 1.0))\n" c̲at
  "        if style == 'wire':\n" c̲at
  "            w = o.modifiers.new('wire', 'WIREFRAME')\n" c̲at
  "            w.thickness = 0.03 / max(r[3:6])\n" c̲at
  "            w.use_relative_offset = False\n" c̲at
  "        made.append(o)\n" c̲at
  "    groups[name] = made\n" c̲at
  "\n")
Used in: ˡhead

ʰplayLines : Char

value (private) · line 143
ʰplayLines ← ("def lines(name, rows):\n" c̲at
  "    made = []\n" c̲at
  "    for i, r in enumerate(rows):\n" c̲at
  "        n = '%s %d' % (name, i + 1)\n" c̲at
  "        cu = bpy.data.curves.new(n, type='CURVE')\n" c̲at
  "        cu.dimensions = '3D'\n" c̲at
  "        cu.bevel_depth = r[9]\n" c̲at
  "        sp = cu.splines.new('POLY')\n" c̲at
  "        sp.points.add(1)\n" c̲at
  "        sp.points[0].co = tuple(r[0:3]) + (1.0,)\n" c̲at
  "        sp.points[1].co = tuple(r[3:6]) + (1.0,)\n" c̲at
  "        o = bpy.data.objects.new(n, cu)\n" c̲at
  "        scene.collection.objects.link(o)\n" c̲at
  "        o.data.materials.append(glow(n, r[6:9], 2.0))\n" c̲at
  "        made.append(o)\n" c̲at
  "    groups[name] = made\n" c̲at
  "\n")
Used in: ˡhead

ʰplayText : Char

value (private) · line 162
ʰplayText ← ("def text(n, body, size, rgb):\n" c̲at
  "    c = bpy.data.curves.new(n, type='FONT')\n" c̲at
  "    c.body = body\n" c̲at
  "    c.size = size\n" c̲at
  "    c.align_x = 'CENTER'\n" c̲at
  "    c.align_y = 'CENTER'\n" c̲at
  "    if FONT:\n" c̲at
  "        c.font = FONT\n" c̲at
  "    o = bpy.data.objects.new(n, c)\n" c̲at
  "    scene.collection.objects.link(o)\n" c̲at
  "    o.data.materials.append(glow(n, rgb))\n" c̲at
  "    return o\n" c̲at
  "\n" c̲at
  "def labels(name, bodies, rows):\n" c̲at
  "    made = []\n" c̲at
  "    for i, (body, r) in enumerate(zip(bodies.split('|'), rows)):\n" c̲at
  "        o = text('%s %d' % (name, i + 1), body, r[3], r[4:7])\n" c̲at
  "        o.location = r[0:3]\n" c̲at
  "        t = o.constraints.new('TRACK_TO')\n" c̲at
  "        t.target = rig['camera']\n" c̲at
  "        t.track_axis = 'TRACK_Z'\n" c̲at
  "        t.up_axis = 'UP_Y'\n" c̲at
  "        made.append(o)\n" c̲at
  "    groups[name] = made\n" c̲at
  "\n" c̲at
  "def view(d):\n" c̲at
  "    f = rig['camera'].data.view_frame(scene=scene)\n" c̲at
  "    k = d / -f[0].z\n" c̲at
  "    return max(abs(v.x) for v in f) * k, max(abs(v.y) for v in f) * k\n" c̲at
  "\n" c̲at
  "def wrap(body, size, width):\n" c̲at
  "    return textwrap.fill(body, max(1, int(width / (ADVANCE * size))), break_on_hyphens=False)\n" c̲at
  "\n" c̲at
  "def captions(bodies, rows):\n" c̲at
  "    d = 0.05\n" c̲at
  "    hw, hh = view(d)\n" c̲at
  "    size = 0.16 * min(hw, hh)\n" c̲at
  "    line = size\n" c̲at
  "    cam = rig['camera']\n" c̲at
  "    for i, (body, r) in enumerate(zip(bodies.split('|'), rows)):\n" c̲at
  "        body = wrap(body, size, 1.7 * hw)\n" c̲at
  "        n = body.count('\\n')\n" c̲at
  "        o = text('caption %d' % (i + 1), body, size, r[2:5])\n" c̲at
  "        o.data.align_y = 'TOP_BASELINE'\n" c̲at
  "        o.parent = cam\n" c̲at
  "        o.location = (0.0, -0.86 * hh + n * line, -d)\n" c̲at
  "        p = bpy.data.objects.new('plate %d' % (i + 1), cube_mesh())\n" c̲at
  "        scene.collection.objects.link(p)\n" c̲at
  "        p.parent = cam\n" c̲at
  "        p.location = (0.0, -0.86 * hh + 0.35 * size + 0.5 * n * line, -d * 1.002)\n" c̲at
  "        p.scale = (ADVANCE * size * max(len(x) for x in body.split('\\n')) + 1.4 * size, 1.6 * size + n * line, 0.0001)\n" c̲at
  "        p.data.materials.append(glow('plate %d' % (i + 1), (0.0, 0.0, 0.0), 1.0, 0.72))\n" c̲at
  "        for x in (o, p):\n" c̲at
  "            span(x, r[0], r[1])\n" c̲at
  "\n" c̲at
  "def cards(titles, subs, rows):\n" c̲at
  "    d = 0.05\n" c̲at
  "    hw, hh = view(d)\n" c̲at
  "    u = min(hw, hh)\n" c̲at
  "    cam = rig['camera']\n" c̲at
  "    made = []\n" c̲at
  "    for i, (title, sub, r) in enumerate(zip(titles.split('|'), subs.split('|'), rows)):\n" c̲at
  "        p = bpy.data.objects.new('card %d' % (i + 1), cube_mesh())\n" c̲at
  "        scene.collection.objects.link(p)\n" c̲at
  "        p.location = (0.0, 0.0, -d * 1.004)\n" c̲at
  "        p.scale = (2.2 * hw, 2.2 * hh, 0.0001)\n" c̲at
  "        p.data.materials.append(glow('card %d' % (i + 1), r[5:8]))\n" c̲at
  "        parts = [p]\n" c̲at
  "        for j, (body, size, y) in enumerate(((title, 0.34 * u, 0.15 * u), (sub, 0.15 * u, -0.3 * u))):\n" c̲at
  "            if body:\n" c̲at
  "                o = text('card %d %s' % (i + 1, 'title' if j == 0 else 'subtitle'), wrap(body, size, 1.8 * hw), size, r[2:5])\n" c̲at
  "                o.location = (0.0, y, -d)\n" c̲at
  "                parts.append(o)\n" c̲at
  "        for x in parts:\n" c̲at
  "            x.parent = cam\n" c̲at
  "            span(x, r[0], r[1])\n" c̲at
  "        made.append(p)\n" c̲at
  "    groups['cards'] = made\n" c̲at
  "\n")
Used in: ˡhead

ʰplayKeys : Char

value (private) · line 243
ʰplayKeys ← ("def span(o, a, b):\n" c̲at
  "    keys = {1: True, frame(a): False, frame(b) + 1: True} if a > 0 else {1: False, frame(b) + 1: True}\n" c̲at
  "    for f in sorted(keys):\n" c̲at
  "        o.hide_render = keys[f]\n" c̲at
  "        o.keyframe_insert('hide_render', frame=f)\n" c̲at
  "\n" c̲at
  "def shown(name, rows):\n" c̲at
  "    for o, r in zip(groups[name], rows):\n" c̲at
  "        span(o, r[0], r[1])\n" c̲at
  "\n" c̲at
  "def moves(name, times, rows):\n" c̲at
  "    for o, r in zip(groups[name], rows):\n" c̲at
  "        for j, t in enumerate(times):\n" c̲at
  "            o.location = r[6 * j:6 * j + 3]\n" c̲at
  "            o.scale = r[6 * j + 3:6 * j + 6]\n" c̲at
  "            o.keyframe_insert('location', frame=frame(t))\n" c̲at
  "            o.keyframe_insert('scale', frame=frame(t))\n" c̲at
  "\n" c̲at
  "def moves_each(name, times, rows):\n" c̲at
  "    for o, ts, r in zip(groups[name], times, rows):\n" c̲at
  "        for j, t in enumerate(ts):\n" c̲at
  "            o.location = r[6 * j:6 * j + 3]\n" c̲at
  "            o.scale = r[6 * j + 3:6 * j + 6]\n" c̲at
  "            o.keyframe_insert('location', frame=frame(t))\n" c̲at
  "            o.keyframe_insert('scale', frame=frame(t))\n" c̲at
  "\n" c̲at
  "def tints(name, times, rows):\n" c̲at
  "    for o, r in zip(groups[name], rows):\n" c̲at
  "        s = o.data.materials[0].node_tree.nodes['glow'].inputs['Color']\n" c̲at
  "        for j, t in enumerate(times):\n" c̲at
  "            s.default_value = tuple(r[3 * j:3 * j + 3]) + (1.0,)\n" c̲at
  "            s.keyframe_insert('default_value', frame=frame(t))\n" c̲at
  "\n" c̲at
  "def glows(name, times, rows):\n" c̲at
  "    for o, ts, r in zip(groups[name], times, rows):\n" c̲at
  "        s = o.data.materials[0].node_tree.nodes['glow'].inputs['Strength']\n" c̲at
  "        for t, g in zip(ts, r):\n" c̲at
  "            s.default_value = g\n" c̲at
  "            s.keyframe_insert('default_value', frame=frame(t))\n" c̲at
  "\n" c̲at
  "def camera(times, eyes, aims):\n" c̲at
  "    for t, e, a in zip(times, eyes, aims):\n" c̲at
  "        rig['camera'].location = e\n" c̲at
  "        rig['camera'].keyframe_insert('location', frame=frame(t))\n" c̲at
  "        rig['aim'].location = a\n" c̲at
  "        rig['aim'].keyframe_insert('location', frame=frame(t))\n" c̲at
  "\n")
Used in: ˡhead

ʰplayGrid : Char

value (private) · line 292
ʰplayGrid ← ("def grid(name, origin, u, v, shape, colors, order, gap):\n" c̲at
  "    n, m = int(shape[0]), int(shape[1])\n" c̲at
  "    k = n * m\n" c̲at
  "    corners = ((gap, gap), (1 - gap, gap), (1 - gap, 1 - gap), (gap, 1 - gap))\n" c̲at
  "    co = []\n" c̲at
  "    for i in range(n):\n" c̲at
  "        for j in range(m):\n" c̲at
  "            for a, b in corners:\n" c̲at
  "                co.extend(origin[c] + (i + a) * u[c] + (j + b) * v[c] for c in range(3))\n" c̲at
  "    me = bpy.data.meshes.new(name)\n" c̲at
  "    me.vertices.add(4 * k)\n" c̲at
  "    me.vertices.foreach_set('co', co)\n" c̲at
  "    me.loops.add(4 * k)\n" c̲at
  "    me.loops.foreach_set('vertex_index', list(range(4 * k)))\n" c̲at
  "    me.polygons.add(k)\n" c̲at
  "    me.polygons.foreach_set('loop_start', list(range(0, 4 * k, 4)))\n" c̲at
  "    me.update()\n" c̲at
  "    col = me.color_attributes.new('rgb', 'FLOAT_COLOR', 'CORNER')\n" c̲at
  "    rgba = []\n" c̲at
  "    for c in colors:\n" c̲at
  "        rgba.extend((tuple((x / 255.0) ** 2.2 for x in c) + (1.0,)) * 4)\n" c̲at
  "    col.data.foreach_set('color', rgba)\n" c̲at
  "    when = me.attributes.new('order', 'FLOAT', 'CORNER')\n" c̲at
  "    when.data.foreach_set('value', [t[0] / 1000.0 - 0.001 for t in order for _ in range(4)])\n" c̲at
  "    o = bpy.data.objects.new(name, me)\n" c̲at
  "    scene.collection.objects.link(o)\n" c̲at
  "    m = bpy.data.materials.new(name)\n" c̲at
  "    m.use_nodes = True\n" c̲at
  "    nt = m.node_tree\n" c̲at
  "    for x in list(nt.nodes):\n" c̲at
  "        nt.nodes.remove(x)\n" c̲at
  "    a = nt.nodes.new('ShaderNodeAttribute')\n" c̲at
  "    a.attribute_name = 'rgb'\n" c̲at
  "    w = nt.nodes.new('ShaderNodeAttribute')\n" c̲at
  "    w.attribute_name = 'order'\n" c̲at
  "    now = nt.nodes.new('ShaderNodeValue')\n" c̲at
  "    now.name = 'now'\n" c̲at
  "    lt = nt.nodes.new('ShaderNodeMath')\n" c̲at
  "    lt.operation = 'LESS_THAN'\n" c̲at
  "    e = nt.nodes.new('ShaderNodeEmission')\n" c̲at
  "    tr = nt.nodes.new('ShaderNodeBsdfTransparent')\n" c̲at
  "    mx = nt.nodes.new('ShaderNodeMixShader')\n" c̲at
  "    out_ = nt.nodes.new('ShaderNodeOutputMaterial')\n" c̲at
  "    nt.links.new(a.outputs['Color'], e.inputs['Color'])\n" c̲at
  "    nt.links.new(w.outputs['Fac'], lt.inputs[0])\n" c̲at
  "    nt.links.new(now.outputs[0], lt.inputs[1])\n" c̲at
  "    nt.links.new(lt.outputs[0], mx.inputs[0])\n" c̲at
  "    nt.links.new(tr.outputs[0], mx.inputs[1])\n" c̲at
  "    nt.links.new(e.outputs[0], mx.inputs[2])\n" c̲at
  "    nt.links.new(mx.outputs[0], out_.inputs[0])\n" c̲at
  "    m.surface_render_method = 'BLENDED'\n" c̲at
  "    me.materials.append(m)\n" c̲at
  "    s = now.outputs[0]\n" c̲at
  "    bpy.context.preferences.edit.keyframe_new_interpolation_type = 'LINEAR'\n" c̲at
  "    for f in (scene.frame_start, scene.frame_end):\n" c̲at
  "        s.default_value = (f - 1) / scene.render.fps\n" c̲at
  "        s.keyframe_insert('default_value', frame=f)\n" c̲at
  "    bpy.context.preferences.edit.keyframe_new_interpolation_type = 'BEZIER'\n" c̲at
  "    groups[name] = [o]\n" c̲at
  "\n")
Used in: ˡhead

ʰplayOutput : Char

value (private) · line 354
ʰplayOutput ← ("def stills(times, prefix):\n" c̲at
  "    scene.render.image_settings.media_type = 'IMAGE'\n" c̲at
  "    scene.render.image_settings.file_format = 'PNG'\n" c̲at
  "    for i, t in enumerate(times):\n" c̲at
  "        scene.frame_set(frame(t))\n" c̲at
  "        scene.render.filepath = os.path.join(out, '%s-%d.png' % (prefix, i + 1))\n" c̲at
  "        bpy.ops.render.render(write_still=True)\n" c̲at
  "\n" c̲at
  "def video(file):\n" c̲at
  "    scene.render.image_settings.media_type = 'VIDEO'\n" c̲at
  "    scene.render.image_settings.file_format = 'FFMPEG'\n" c̲at
  "    scene.render.ffmpeg.format = 'MPEG4'\n" c̲at
  "    scene.render.ffmpeg.codec = 'H264'\n" c̲at
  "    scene.render.ffmpeg.constant_rate_factor = 'HIGH'\n" c̲at
  "    scene.render.filepath = os.path.join(out, file)\n" c̲at
  "    bpy.ops.render.render(animation=True)\n" c̲at
  "\n" c̲at
  "def animated(x):\n" c̲at
  "    return bool(x and x.animation_data and x.animation_data.action)\n" c̲at
  "\n" c̲at
  "def report():\n" c̲at
  "    with open(os.path.join(out, 'report.txt'), 'w') as f:\n" c̲at
  "        f.write('frames %d to %d at %d a second\\n' % (scene.frame_start, scene.frame_end, scene.render.fps))\n" c̲at
  "        for name in sorted(groups):\n" c̲at
  "            os_ = groups[name]\n" c̲at
  "            keyed = sum(1 for o in os_ if animated(o) or any(m and animated(m.node_tree) for m in getattr(o.data, 'materials', [])))\n" c̲at
  "            f.write('%s: %d objects, %d keyed\\n' % (name, len(os_), keyed))\n" c̲at
  "\n")
Used in: ˡhead

ʰplaySteps : Char

value (private) · line 384
ʰplaySteps ← ("def steps(name, path, rows):\n" c̲at
  "    made = groups[name]\n" c̲at
  "    last = {}\n" c̲at
  "    for r in rows:\n" c̲at
  "        i = int(r[0]) - 1\n" c̲at
  "        o = made[i]\n" c̲at
  "        f = frame(r[1])\n" c̲at
  "        v = r[2] if path == 'glow' else r[2:5]\n" c̲at
  "        if path == 'glow':\n" c̲at
  "            o, attr = o.data.materials[0].node_tree.nodes['glow'].inputs['Strength'], 'default_value'\n" c̲at
  "        else:\n" c̲at
  "            attr = path\n" c̲at
  "        if i in last and last[i][0] < f - 1:\n" c̲at
  "            setattr(o, attr, last[i][1])\n" c̲at
  "            o.keyframe_insert(attr, frame=f - 1)\n" c̲at
  "        setattr(o, attr, v)\n" c̲at
  "        o.keyframe_insert(attr, frame=f)\n" c̲at
  "        last[i] = (f, v)\n" c̲at
  "\n" c̲at
  "def readout(name, row, bodies, times):\n" c̲at
  "    d = 0.05\n" c̲at
  "    hw, hh = view(d)\n" c̲at
  "    o = text(name, '', row[2] * min(hw, hh), row[3:6])\n" c̲at
  "    o.parent = rig['camera']\n" c̲at
  "    o.location = (row[0] * hw, row[1] * hh, -d)\n" c̲at
  "    fs = [frame(t) for t in times]\n" c̲at
  "    bodies = bodies.split('|')\n" c̲at
  "    def show(sc, *rest):\n" c̲at
  "        body = ''\n" c̲at
  "        for f, b in zip(fs, bodies):\n" c̲at
  "            if f > sc.frame_current:\n" c̲at
  "                break\n" c̲at
  "            body = b\n" c̲at
  "        if o.data.body != body:\n" c̲at
  "            o.data.body = body\n" c̲at
  "    bpy.app.handlers.frame_change_pre.append(show)\n" c̲at
  "    groups[name] = [o]\n" c̲at
  "\n" c̲at
  "def picture(name, path, row):\n" c̲at
  "    img = bpy.data.images.load(os.path.abspath(path))\n" c̲at
  "    w = row[3]\n" c̲at
  "    h = w * img.size[1] / img.size[0]\n" c̲at
  "    me = bpy.data.meshes.new(name)\n" c̲at
  "    me.from_pydata([(-w / 2, 0, -h / 2), (w / 2, 0, -h / 2), (w / 2, 0, h / 2), (-w / 2, 0, h / 2)], [], [(0, 1, 2, 3)])\n" c̲at
  "    uv = me.uv_layers.new()\n" c̲at
  "    for i, c in enumerate(((0, 0), (1, 0), (1, 1), (0, 1))):\n" c̲at
  "        uv.data[i].uv = c\n" c̲at
  "    o = bpy.data.objects.new(name, me)\n" c̲at
  "    scene.collection.objects.link(o)\n" c̲at
  "    o.location = row[0:3]\n" c̲at
  "    m = glow(name, (1.0, 1.0, 1.0))\n" c̲at
  "    t = m.node_tree.nodes.new('ShaderNodeTexImage')\n" c̲at
  "    t.image = img\n" c̲at
  "    m.node_tree.links.new(t.outputs['Color'], m.node_tree.nodes['glow'].inputs['Color'])\n" c̲at
  "    me.materials.append(m)\n" c̲at
  "    groups[name] = [o]\n" c̲at
  "\n")
Used in: ˡhead

ˡhead : Char

value · line 447

vd:head: the inner script's start, the player: an empty scene, the output directory (the first argument after "--"), keys eased in and out (Bezier), and the functions the calls below use -- stage, boxes, lines, labels, captions, cards, shown, moves, tints, glows, camera, grid, steps, readout, picture, stills, video, report. Fixed text: what a video shows is all in the numbers after it.

ˡhead ← ʰplayBase c̲at ʰplayStage c̲at ʰplayLines c̲at ʰplayText c̲at ʰplayKeys c̲at ʰplayGrid c̲at ʰplaySteps c̲at ʰplayOutput

Numbers and text into Python

ʰn̲ums : Any c => (a, b) -> c -> Char

function (private) · line 452
ʰn̲ums ← { (v, k) z → "nums('" c̲at (f̲ormat r̲avel v) c̲at "', " c̲at (f̲ormat k) c̲at ")" }

ʰq̲uoteIn : Int -> Char -> Char

function (private) · line 457
ʰq̲uoteIn ← { q t →
  0 = t̲ally t ? ⎕U̲CHAR q c̲at q
  c ← ⎕U̲CS t
  e ← (c = q) ∨ c = 92
  k ← (1 + e) r̲eplicate r̲ange t̲ally c
  m ← ((1 + e) r̲eplicate e) ∧ k ≠ 0 c̲at -1 d̲rop k
  (⎕U̲CHAR q) c̲at (⎕U̲CHAR (92 × m) + (1 − m) × (1 + e) r̲eplicate c) c̲at ⎕U̲CHAR q
}

ʰq̲uote : Char -> Char

function (private) · line 467
ʰq̲uote ← { t → 39 ʰq̲uoteIn t }

ʰo̲ne : Int -> Float -> Char

function (private) · line 470
ʰo̲ne ← { d x →
  k ← 10 ^ d
  n ← f̲loor 0.5 + (f̲loat k) × a̲bs x
  s ← (x < 0.0) ∧ n > 0
  (s t̲ake "-") c̲at (f̲ormat n d̲iv k) c̲at ((d > 0) t̲ake ".") c̲at 1 d̲rop f̲ormat k + n m̲od k
}
Used in: ˡf̲ixed

ʰj̲oin : Box Char -> Box Char -> Box Char

function (private) · line 478
ʰj̲oin ← { a b → e̲nclose (d̲isclose a) c̲at "|" c̲at d̲isclose b }
Used in: ˡf̲ixed

ˡf̲ixed : Int -> Float -> Char

function · line 487

d vd:f_ixed values: the values as text, each with d digits after the point (none and no point for 0), rounded, separated by | -- the labels of vd:l_abels

      "vd:" u̲se< "Video"
      2 ᵛᵈf̲ixed 0.75 -1.0 0.125 -0.004
0.75|-1.00|0.13|0.00
      0 ᵛᵈf̲ixed 1.0 -1.0 44.0
1|-1|44
ˡf̲ixed ← { d v → d̲isclose 'ʰj̲oin r̲/ '{ x → d ʰo̲ne x } m̲ap r̲avel v }

Colors

ˡl̲inear : Num a => a -> Float

function · line 496

vd:l_inear rgb: colors written 0 to 255 (sRGB, a row of red green blue each, any number of rows) as Blender's linear 0 to 1

      "vd:" u̲se< "Video"
      ᵛᵈl̲inear 255 128 0
1.0 0.2195197180748679 0.0
ˡl̲inear ← { c → ((f̲loat c) ÷ 255.0) ^ 2.2 }

ʰc̲hannel : Num a => a -> Float

function (private) · line 499
ʰc̲hannel ← { c →
  s ← (f̲loat c) ÷ 255.0
  m ← f̲loat s ≤ 0.04045
  (m × s ÷ 12.92) + (1.0 − m) × ((s + 0.055) ÷ 1.055) ^ 2.4
}
Used in: ˡl̲uminance

ˡl̲uminance : Num a => a -> Float

function · line 507

vd:l_uminance rgb: how bright a color (0 to 255, sRGB) is, 0 to 1 (WCAG's relative luminance)

ˡl̲uminance ← { c → '+ r̲/ 0.2126 0.7152 0.0722 × ʰc̲hannel c }
Used in: ˡc̲ontrast

ˡc̲ontrast : (Num a, Num b) => a -> b -> Float

function · line 514

a vd:c_ontrast b: the contrast of two colors (0 to 255, sRGB), 1 to 21 (WCAG): text should be 7 or more on its background

      "vd:" u̲se< "Video"
      f̲loor 255 255 255 ᵛᵈc̲ontrast 0 0 0
21
ˡc̲ontrast ← { a b →
  la ← ˡl̲uminance a
  lb ← ˡl̲uminance b
  ((la m̲ax lb) + 0.05) ÷ (la m̲in lb) + 0.05
}

ˡstops : Int

value · line 522

the stops of vd:t_one, low to high: deep blue, cyan, yellow, orange (0 to 255)

ˡstops ← 4 3 r̲eshape 43 74 154  47 183 214  255 216 77  255 122 61
Used in: ˡt̲one

ˡt̲one : (Num a, Any b) => (a, Float, Float) -> b -> Float

function · line 533

(values, low, high) vd:t_one 0: a color for each value (n by 3, 0 to 255): low is deep blue, high orange, through cyan and yellow, mixed between the stops; values outside are the ends' colors -- how big a number is, at a glance

      "vd:" u̲se< "Video"
      (0.0 0.5 1.0, 0.0, 1.0) ᵛᵈt̲one 0
 43.0  74.0 154.0
151.0 199.5 145.5
255.0 122.0  61.0
ˡt̲one ← { (v, lo, hi) z →
  x ← 3.0 × 0.0 m̲ax 1.0 m̲in ((f̲loat r̲avel v) − lo) ÷ 0.000000001 m̲ax hi − lo
  i ← 2 m̲in f̲loor x
  u ← x − f̲loat i
  a ← (i + 1) s̲elect f̲loat ˡstops
  b ← (i + 2) s̲elect f̲loat ˡstops
  (a × (1.0 − u) 'l̲eft t̲able 1 2 3) + b × u 'l̲eft t̲able 1 2 3
}

Pictures and time

ˡlandscape : Int

value · line 545

vd:landscape: a YouTube video's picture, 1920 by 1080 (width, height)

ˡlandscape ← 1920 1080
Used in: _, _, _, _, _, _, _

ˡshorts : Int

value · line 548

vd:shorts: a YouTube Short's picture, 1080 by 1920, upright

ˡshorts ← 1080 1920
Used in: _, _, _, _, _, _, _

ˡf̲it : (Num a, Num b, Any c) => (a, a, b, Float, Float) -> c -> Float

function · line 560

(width, height, lens, w, h) vd:f_it 0: how far from a region w by h (meters, facing it) a camera with that lens (mm) stands for the region to just fill a picture width by height (pixels): Blender fits its 36 mm sensor to the picture's longer side, so the same region needs the camera further back in a Short

      "vd:" u̲se< "Video"
      (1920, 1080, 36, 4.0, 1.0) ᵛᵈf̲it 0
4.0
      (1000, 2000, 36, 2.0, 2.0) ᵛᵈf̲it 0
4.0
ˡf̲it ← { (pw, ph, lens, w, h) z →
  t ← 18.0 ÷ f̲loat lens
  tw ← t × (f̲loat pw) ÷ f̲loat pw m̲ax ph
  th ← t × (f̲loat ph) ÷ f̲loat pw m̲ax ph
  ((0.5 × w) ÷ tw) m̲ax (0.5 × h) ÷ th
}

ˡr̲etime : (Num a, Num b, Any c) => (a, b) -> c -> Float

function · line 578

(map, times) vd:r_etime 0: a scene's own seconds as the video's: map is k by 2 (k at least 2), a row a pair (scene second, video second), both increasing; a time between two rows falls between their video seconds in proportion, one before the first or after the last on the nearest pair's line. Where the video has more seconds than the scene it is slow motion, fewer a time-lapse: a scene is worked out in its own seconds and every time in it -- spans, keys, the camera, captions -- passed through the map. Times of any shape.

      "vd:" u̲se< "Video"
      (3 2 r̲eshape 0 0  4 8  8 9, 0.0 2.0 4.0 6.0 8.0 10.0) ᵛᵈr̲etime 0
0.0 4.0 8.0 8.5 9.0 9.5
ˡr̲etime ← { (m, t) z →
  s ← f̲loat 1 s̲elect₂ m
  v ← f̲loat 2 s̲elect₂ m
  k ← t̲ally s
  '{ x →
    i ← 1 m̲ax (k − 1) m̲in '+ r̲/ s ≤ x
    (i s̲elect v) + ((x − i s̲elect s) × ((i + 1) s̲elect v) − i s̲elect v) ÷ ((i + 1) s̲elect s) − i s̲elect s
  } e̲ach f̲loat t
}

Cues

ʰt̲exts : Char -> Box Char

function (private) · line 591
ʰt̲exts ← { t → (n̲ot t = f̲irst "|") p̲artition t }
Used in: ˡs̲rt, ˡc̲ues

ʰc̲at : Box a -> Box a -> Box a

function (private) · line 594
ʰc̲at ← { a b → e̲nclose (d̲isclose a) c̲at d̲isclose b }
Used in: ˡs̲rt, ˡc̲ues

ʰs̲rtTime : Float -> Char

function (private) · line 597
ʰs̲rtTime ← { x →
  ms ← f̲loor 0.5 + 1000.0 × x
  (1 d̲rop f̲ormat 100 + ms d̲iv 3600000) c̲at ":" c̲at (1 d̲rop f̲ormat 100 + (ms d̲iv 60000) m̲od 60) c̲at ":" c̲at (1 d̲rop f̲ormat 100 + (ms d̲iv 1000) m̲od 60) c̲at "," c̲at 1 d̲rop f̲ormat 1000 + ms m̲od 1000
}
Used in: ˡs̲rt

ˡs̲rt : Any a => (Char, Float) -> a -> Char

function · line 613

(texts, table) vd:s_rt 0: the captions as subtitles, an .srt file's text: one a row of the table, from and to (seconds; more columns, as vd:c_aptions's colors, are ignored), texts as vd:c_aptions's (none empty) -- what an editor or YouTube shows under the video, timed to the narration recorded against it

      "vd:" u̲se< "Video"
      ("two", 1 2 r̲eshape 61.0 3725.5) ᵛᵈs̲rt 0
1
00:01:01,000 --> 01:02:05,500
two
ˡs̲rt ← { (texts, t) z →
  b ← ʰt̲exts texts
  a ← 1 s̲elect₂ t
  e ← 2 s̲elect₂ t
  d̲isclose 'ʰc̲at r̲/ '{ i → (f̲ormat i) c̲at "\n" c̲at (ʰs̲rtTime i s̲elect a) c̲at " --> " c̲at (ʰs̲rtTime i s̲elect e) c̲at "\n" c̲at (d̲isclose i s̲elect b) c̲at "\n\n" } m̲ap r̲ange t̲ally b
}
Used in: _, _, _, _, _, _, _

ˡc̲ues : Any a => (Char, Float) -> a -> Char

function · line 632

(texts, table) vd:c_ues 0: the cue sheet of the same captions, as TOML: a [[cue]] a row -- its number, start and end (seconds) and its caption -- the scenes to record narration against, read by a program (arguments as vd:s_rt's)

      "vd:" u̲se< "Video"
      ("the \"top\"", 1 2 r̲eshape 0.0 3.5) ᵛᵈc̲ues 0
[[cue]]
n = 1
start = 0.000
end = 3.500
caption = "the \"top\""
ˡc̲ues ← { (texts, t) z →
  b ← ʰt̲exts texts
  a ← 1 s̲elect₂ t
  e ← 2 s̲elect₂ t
  d̲isclose 'ʰc̲at r̲/ '{ i → "[[cue]]\nn = " c̲at (f̲ormat i) c̲at "\nstart = " c̲at (3 ˡf̲ixed i s̲elect a) c̲at "\nend = " c̲at (3 ˡf̲ixed i s̲elect e) c̲at "\ncaption = " c̲at (34 ʰq̲uoteIn d̲isclose i s̲elect b) c̲at "\n\n" } m̲ap r̲ange t̲ally b
}
Used in: _, _, _, _, _, _, _

The calls

ˡs̲tage : (Num e, Any g) => (a, b, c, d, e, f) -> g -> Char

function · line 646

(width, height, fps, seconds, sky, lens) vd:s_tage 0: Python setting the picture's size, the frame rate and the video's length, EEVEE and the Standard view, the sky's color (0 to 255), and the camera (a lens of that many mm) looking at an aim; both start at the origin until vd:c_amera keys them. First, before any group.

ˡs̲tage ← { (w, h, fps, secs, sky, lens) z →
  "stage(" c̲at (f̲ormat w) c̲at ", " c̲at (f̲ormat h) c̲at ", " c̲at (f̲ormat fps) c̲at ", " c̲at (f̲ormat secs) c̲at ", " c̲at ((ˡl̲inear sky, 3) ʰn̲ums 0) c̲at "[0], " c̲at (f̲ormat lens) c̲at ")\n"
}

ʰb̲oxes : Num a => Char -> (Char, a) -> Char

function (private) · line 651
ʰb̲oxes ← { style (name, t) →
  "boxes(" c̲at (ʰq̲uote name) c̲at ", " c̲at (((ʰp̲aint t), 10) ʰn̲ums 0) c̲at ", " c̲at (ʰq̲uote style) c̲at ")\n"
}

ʰp̲aint : Num a => a -> Float

function (private) · line 656
ʰp̲aint ← { t →
  (6 t̲ake₂ f̲loat t) c̲at₂ (ˡl̲inear 3 t̲ake₂ 6 d̲rop₂ t) c̲at₂ 10 s̲elect₂ f̲loat t
}
Used in: ʰb̲oxes

ˡb̲oxes : (Num a, Any b) => (Char, a) -> b -> Char

function · line 668

(name, table) vd:b_oxes 0: Python making a group of solid boxes, objects NAME 1 to NAME n, one a row of the table: x y z (its middle), w d h (its size), r g b (0 to 255) and how strongly it glows (1 is its color as given). A bar of height h standing on the floor has its middle at h / 2; one hanging below it at -h / 2.

      "vd:" u̲se< "Video"
      ("bar", 1 10 r̲eshape 0 0 1 1 1 2 255 255 255 1) ᵛᵈb̲oxes 0
boxes('bar', nums('0.0 0.0 1.0 1.0 1.0 2.0 1.0 1.0 1.0 1.0', 10), 'solid')
ˡb̲oxes ← { (name, t) z → "solid" ʰb̲oxes (name, t) }

ˡo̲utlines : (Num a, Any b) => (Char, a) -> b -> Char

function · line 673

(name, table) vd:o_utlines 0: Python making a group of boxes drawn as their edges only (a wireframe), rows as vd:b_oxes: what a value was before it went

ˡo̲utlines ← { (name, t) z → "wire" ʰb̲oxes (name, t) }

ˡg̲lass : (Num a, Any b) => (Char, a) -> b -> Char

function · line 678

(name, table) vd:g_lass 0: Python making a group of see-through boxes, rows as vd:b_oxes: a floor at zero that bars stand on and hang below

ˡg̲lass ← { (name, t) z → "glass" ʰb̲oxes (name, t) }

ˡl̲ines : (Num a, Any b) => (Char, a) -> b -> Char

function · line 683

(name, table) vd:l_ines 0: Python making a group of straight lines that glow, one a row of the table: from x y z, to x y z, r g b (0 to 255) and the line's radius -- a guide from one thing to another

ˡl̲ines ← { (name, t) z →
  p ← (6 t̲ake₂ f̲loat t) c̲at₂ (ˡl̲inear 3 t̲ake₂ 6 d̲rop₂ t) c̲at₂ 10 s̲elect₂ f̲loat t
  "lines(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((p, 10) ʰn̲ums 0) c̲at ")\n"
}

ˡl̲abels : (Num a, Any b) => (Char, Char, a) -> b -> Char

function · line 692

(name, texts, table) vd:l_abels 0: Python making a group of words, one a row of the table -- x y z (its middle), its height, r g b (0 to 255) -- each turned to face the camera; texts are the words, | between them (vd:f_ixed writes numbers so)

ˡl̲abels ← { (name, texts, t) z →
  p ← (4 t̲ake₂ f̲loat t) c̲at₂ ˡl̲inear 3 t̲ake₂ 4 d̲rop₂ t
  "labels(" c̲at (ʰq̲uote name) c̲at ", " c̲at (ʰq̲uote texts) c̲at ", " c̲at ((p, 7) ʰn̲ums 0) c̲at ")\n"
}

ˡc̲aptions : (Num a, Any b) => (Char, a) -> b -> Char

function · line 702

(texts, table) vd:c_aptions 0: Python putting captions near the bottom of the picture, on a dark plate, one a row of the table: from and to (seconds), r g b (0 to 255); texts as vd:l_abels. Sized to the picture's shorter side and wrapped to its width, so the same captions read in a Short (vd:c_ues and vd:s_rt write them for narration)

ˡc̲aptions ← { (texts, t) z →
  p ← (2 t̲ake₂ f̲loat t) c̲at₂ ˡl̲inear 2 d̲rop₂ t
  "captions(" c̲at (ʰq̲uote texts) c̲at ", " c̲at ((p, 5) ʰn̲ums 0) c̲at ")\n"
}

ˡs̲hown : (Num a, Any b) => (Char, a) -> b -> Char

function · line 710

(name, spans) vd:s_hown 0: Python showing each object of the group only from one second to another, a row of spans each (n by 2); a span from 0 shows it from the start

ˡs̲hown ← { (name, s) z → "shown(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((f̲loat s, 2) ʰn̲ums 0) c̲at ")\n" }

ˡm̲oves : (Num a, Num b, Any c) => (Char, a, b) -> c -> Char

function · line 715

(name, times, places) vd:m_oves 0: Python keying each object of the group to its place and size at the times (k seconds): places is n by k by 6, x y z w d h; between keys they ease from one to the next

ˡm̲oves ← { (name, ts, p) z →
  k ← 6 × t̲ally ts
  "moves(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((f̲loat ts, t̲ally ts) ʰn̲ums 0) c̲at "[0], " c̲at ((f̲loat p, k) ʰn̲ums 0) c̲at ")\n"
}

ˡm̲ovesEach : (Num a, Num b, Any c) => (Char, a, b) -> c -> Char

function · line 723

(name, times, places) vd:m_ovesEach 0: as vd:m_oves, but each object keyed at times of its own: times is n by k, a row an object -- things that move one after another

ˡm̲ovesEach ← { (name, ts, p) z →
  k ← 2 s̲elect s̲hape ts
  "moves_each(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((f̲loat ts, k) ʰn̲ums 0) c̲at ", " c̲at ((f̲loat p, 6 × k) ʰn̲ums 0) c̲at ")\n"
}
Used in: ˡi̲tems

ˡt̲ints : (Num a, Num b, Any c) => (Char, a, b) -> c -> Char

function · line 730

(name, times, colors) vd:t_ints 0: Python keying each object's color at the times (k seconds): colors is n by k by 3, 0 to 255

ˡt̲ints ← { (name, ts, c) z →
  k ← 3 × t̲ally ts
  "tints(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((f̲loat ts, t̲ally ts) ʰn̲ums 0) c̲at "[0], " c̲at ((ˡl̲inear c, k) ʰn̲ums 0) c̲at ")\n"
}

ˡg̲lows : (Num a, Num b, Any c) => (Char, a, b) -> c -> Char

function · line 740

(name, times, strengths) vd:g_lows 0: Python keying how strongly each object of the group glows (1 is its color as given, 0 dark), at times of its own: times and strengths are n by k, a row an object -- a value's size or a part's activity as light (a flash when a register is written, a cell lit as it is reached)

ˡg̲lows ← { (name, ts, g) z →
  k ← 2 s̲elect s̲hape ts
  "glows(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((f̲loat ts, k) ʰn̲ums 0) c̲at ", " c̲at ((f̲loat g, k) ʰn̲ums 0) c̲at ")\n"
}

ˡc̲ards : (Num a, Any b) => (Char, Char, a) -> b -> Char

function · line 751

(titles, subtitles, table) vd:c_ards 0: Python putting title cards in front of the camera, each filling the picture, one a row of the table: from and to (seconds), r g b of the words, r g b of the card (0 to 255); a title big in the middle, its subtitle smaller below, each wrapped to the picture's width; | between the cards' texts (an empty subtitle: none)

ˡc̲ards ← { (titles, subs, t) z →
  p ← (2 t̲ake₂ f̲loat t) c̲at₂ (ˡl̲inear 3 t̲ake₂ 2 d̲rop₂ t) c̲at₂ ˡl̲inear 3 t̲ake₂ 5 d̲rop₂ t
  "cards(" c̲at (ʰq̲uote titles) c̲at ", " c̲at (ʰq̲uote subs) c̲at ", " c̲at ((p, 8) ʰn̲ums 0) c̲at ")\n"
}

ˡc̲amera : (Num a, Num b, Num c, Any d) => (a, b, c) -> d -> Char

function · line 758

(times, eyes, aims) vd:c_amera 0: Python keying the camera: at each time (k seconds) it is at an eye (k by 3) looking at an aim (k by 3)

ˡc̲amera ← { (ts, e, a) z →
  "camera(" c̲at ((f̲loat ts, t̲ally ts) ʰn̲ums 0) c̲at "[0], " c̲at ((f̲loat e, 3) ʰn̲ums 0) c̲at ", " c̲at ((f̲loat a, 3) ʰn̲ums 0) c̲at ")\n"
}

ˡs̲teps : (Num a, Any b) => (Char, Char, a) -> b -> Char

function · line 773

(name, what, rows) vd:s_teps 0: Python keying the group's objects in steps -- each value holds until the next (keyed again the frame before it), the change within one frame: a lamp on or off, a marker jumping from place to place, a bar's new length. A row a key: the object (from 1), the second, then its value -- what "glow" (how strongly it glows), "location" (x y z) or "scale" (w d h). Rows for one object in time order; data sampled once a frame keys only where it changed

      "vd:" u̲se< "Video"
      ("lamp", "glow", 2 3 r̲eshape 1 0.0 0.0  1 2.5 1.0) ᵛᵈs̲teps 0
steps('lamp', 'glow', nums('1.0 0.0 0.0 1.0 2.5 1.0', 3))
ˡs̲teps ← { (name, what, rows) z →
  k ← 2 s̲elect s̲hape rows
  "steps(" c̲at (ʰq̲uote name) c̲at ", " c̲at (ʰq̲uote what) c̲at ", " c̲at ((f̲loat rows, k) ʰn̲ums 0) c̲at ")\n"
}

ˡr̲eadout : (Num a, Num b, Any c) => (Char, a, Char, b) -> c -> Char

function · line 786

(name, place, texts, times) vd:r_eadout 0: Python putting a readout in front of the camera -- a counter, a register's name -- that shows each text from its time (seconds, increasing) until the next, nothing before the first: texts | between them, as vd:l_abels. place: x and y as fractions of the picture's half width and half height from its middle, the text's height as a fraction of its shorter half, r g b (0 to 255). The text changes as the video plays (a frame handler), so the numbers are the data's own, not keys

ˡr̲eadout ← { (name, p, texts, ts) z →
  q ← (3 t̲ake f̲loat p) c̲at ˡl̲inear 3 d̲rop p
  "readout(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((q, t̲ally q) ʰn̲ums 0) c̲at "[0]" c̲at ", " c̲at (ʰq̲uote texts) c̲at ", " c̲at ((f̲loat ts, t̲ally ts) ʰn̲ums 0) c̲at "[0])\n"
}

ˡp̲icture : (Num a, Any b) => (Char, Char, a) -> b -> Char

function · line 796

(name, path, place) vd:p_icture 0: Python putting a picture (a PNG, path from the working directory) in the scene, upright and facing -y, glowing as its own colors: place is x y z (its middle) and its width (meters); its height keeps the picture's shape -- a screenshot beside the model of what it shows

ˡp̲icture ← { (name, path, p) z →
  "picture(" c̲at (ʰq̲uote name) c̲at ", " c̲at (ʰq̲uote path) c̲at ", " c̲at ((f̲loat p, 4) ʰn̲ums 0) c̲at "[0]" c̲at ")\n"
}
Used in: ˡs̲cene

ˡg̲rid : (Num a, Num b, Num c, Num d, Num e, Any g) => (Char, a, b, c, d, e, f) -> g -> Char

function · line 809

(name, origin, u, v, colors, order, gap) vd:g_rid 0: Python making a grid of n by m flat cells as one mesh: cell (i, j) spans origin + i u to origin + (i + 1) u along one side and j v along the other, less gap (a fraction) at each edge; colors is n by m by 3 (0 to 255) and order n by m, the second each cell appears (0: from the start) -- a wall of a matrix, filled in as it is worked out. Written compactly for big grids (a 512 by 512 wall is 262,144 cells): the colors as whole numbers, made linear by the player, the seconds as whole milliseconds.

ˡg̲rid ← { (name, at, u, v, c, w, g) z →
  s ← 2 t̲ake s̲hape c
  cs ← f̲loor 0.5 + f̲loat c
  ms ← f̲loor 0.5 + 1000.0 × f̲loat w
  "grid(" c̲at (ʰq̲uote name) c̲at ", " c̲at ((f̲loat at, 3) ʰn̲ums 0) c̲at "[0], " c̲at ((f̲loat u, 3) ʰn̲ums 0) c̲at "[0], " c̲at ((f̲loat v, 3) ʰn̲ums 0) c̲at "[0], " c̲at ((f̲loat s, 2) ʰn̲ums 0) c̲at "[0], " c̲at ((cs, 3) ʰn̲ums 0) c̲at ", " c̲at ((ms, 1) ʰn̲ums 0) c̲at ", " c̲at (f̲ormat g) c̲at ")\n"
}
Used in: ˡw̲alls

ˡs̲tills : (Num a, Any b) => (a, Char) -> b -> Char

function · line 818

(times, name) vd:s_tills 0: Python rendering the frames at the times (seconds) as out/NAME-1.png, NAME-2.png, ...

ˡs̲tills ← { (ts, name) z → "stills(" c̲at ((f̲loat ts, t̲ally ts) ʰn̲ums 0) c̲at "[0], " c̲at (ʰq̲uote name) c̲at ")\n" }
Used in: script, script, script

ˡr̲ender : Char -> Char

function · line 822

vd:r_ender file: Python rendering every frame to out/FILE, an MP4 (H.264)

ˡr̲ender ← { file → "video(" c̲at (ʰq̲uote file) c̲at ")\n" }
Used in: _, _, _, _, _, _, _, script, script, script

ˡreport : Char

value · line 827

vd:report: Python writing out/report.txt: the frames, and each group, how many objects and how many of them keyed (the object or its material: a tint or a glow) -- what a test checks

ˡreport ← "report()\n"
Used in: _, _, _, _, _, _, _, script, script, script