"""Hop on one leg and twirl (a friend's request, 2026-10-11): standing on the right leg, left foot tucked up behind, arms out for balance, a full turn in 2.4 s with a small hop every quarter turn. Claude Opus 5.5.""" import json from pathlib import Path N = 16 # keys over one turn; 22.5 deg apart keeps SL's shortest-path slerp going one way DUR = 2.4 keys = [] for i in range(N + 1): t = round(DUR * i / N, 3) yaw = -360.0 * i / N # clockwise seen from above ph = (i % 4) / 4.0 # hop phase within each quarter turn up = 0.14 * 4 * ph * (1 - ph) keys.append({"t": t, "pos": {"mPelvis": [0, 0, up]}, "rot": {"mPelvis": [0, 0, yaw], "mHead": [0, -6, 0]}, "aim": {"mShoulderLeft": [0.15, 1, 0.25], "mElbowLeft": [0.3, 1, 0.45], "mShoulderRight": [0.15, -1, 0.25], "mElbowRight": [0.3, -1, 0.45], "mHipLeft": [0.35, 0.12, -0.93], "mKneeLeft": [-0.85, 0.05, -0.5], "mAnkleLeft": [0.2, 0, -1], "mHipRight": [0, -0.03, -1], "mKneeRight": [0.05 * (1 - up / 0.14), -0.03, -1]}}) spec = {"name": "tessel twirl", "duration": DUR, "priority": 4, "loop": True, "loop_in": 0.0, "loop_out": DUR, "ease_in": 0.3, "ease_out": 0.3, "hand_pose": "spread", "keys": keys} Path(__file__).with_name("twirl.json").write_text("// generated by gen_twirl.py\n" + json.dumps(spec, indent=1))