"""Ninja run (a friend's request, 2026-10-11): torso pitched far forward, arms swept straight back, legs in a fast running cycle. 0.6 s loop, priority 5: play it while running. Claude Opus 5.5.""" import json, math from pathlib import Path N = 8; DUR = 0.6 keys = [] for i in range(N + 1): t = round(DUR * i / N, 4); ph = 2 * math.pi * i / N def leg(p): # p: phase; hip swings forward/back, knee folds on the back-swing swing = math.sin(p) hip = [0.55 * swing, 0, -1] knee_bend = max(0.0, -math.cos(p)) * 1.2 + 0.2 knee = [0.55 * swing - knee_bend, 0, -1] return hip, knee hl, kl = leg(ph); hr, kr = leg(ph + math.pi) keys.append({"t": t, "pos": {"mPelvis": [0, 0, -0.06 + 0.04 * abs(math.cos(ph))]}, "rot": {"mTorso": [0, 38, 0], "mChest": [0, 8, 0], "mHead": [0, -36, 0]}, "aim": {"mShoulderLeft": [-1, 0.18, 0.35], "mElbowLeft": [-1, 0.1, 0.4], "mWristLeft": [-1, 0.05, 0.45], "mShoulderRight": [-1, -0.18, 0.35], "mElbowRight": [-1, -0.1, 0.4], "mWristRight": [-1, -0.05, 0.45], "mHipLeft": hl, "mKneeLeft": kl, "mAnkleLeft": [1, 0, -0.2], "mHipRight": hr, "mKneeRight": kr, "mAnkleRight": [1, 0, -0.2]}}) spec = {"name": "ninja run", "duration": DUR, "priority": 5, "loop": True, "loop_in": 0.0, "loop_out": DUR, "ease_in": 0.2, "ease_out": 0.2, "hand_pose": "spread", "keys": keys} Path(__file__).with_name("ninjarun.json").write_text("// generated by gen_ninjarun.py\n" + json.dumps(spec, indent=1))