Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

test(face): the turning head tilts about its mouth as the band reads it, and only its hair, headset and cheeks go further — the place the band would carry the layer to is the only thing wrong

Soohong Kimf5e7a55f2812
diff --git a/tests/talking_face.py b/tests/talking_face.py
index 1ceb012..e761fb3 100644
--- a/tests/talking_face.py
+++ b/tests/talking_face.py
@@ -9,9 +9,9 @@ tongue in it). A hand can be raised over the right cheek from a sleeve below, a
clip is drawn at twice the size, as a face cut from the reference.
`write_case(root)` writes the reference, a talking clip, five body clips (an idle loop, a greeting that talks with its
-own mouth and closes in a smile, a hand over the cheek, a head that goes 60 px up and back, a head that turns: its
-hair, headset and cheeks move and tilt, its mouth stays), the greeting's mouth timeline and a face request naming them
-all.
+own mouth and closes in a smile, a hand over the cheek, a head that goes 60 px up and back, a head that turns: it
+tilts about its mouth and its hair, headset and cheeks move further, its mouth stays), the greeting's mouth timeline
+and a face request naming them all.
"""
from __future__ import annotations
@@ -54,8 +54,8 @@ GREET_VOICED = range(2, 9)
GREET_OWN_END = 10
HAND_FRAMES = range(4, 9)
JUMP = [-60 * math.sin(math.pi * k / 8) for k in range(9)]
-# a head that turns: its hair, headset and cheeks go 12 px right and tilt 5 degrees, its mouth stays; closed but for
-# two frames that open
+# a head that turns: it tilts 5 degrees about its mouth, and its hair, headset and cheeks go 12 px right as well; its
+# mouth stays where it is. Closed but for two frames that open
TURN_NEAR, TURN_FAR = 45.0, 85.0
TURN = [math.sin(math.pi * k / 10) for k in range(11)]
TURN_MOUTH = ["neutral"] * 4 + [1, 2] + ["neutral"] * 5
@@ -194,7 +194,7 @@ def write_case(root: Path) -> Path:
_clip(root / "greet", greet)
_clip(root / "cheek", [draw({"dy": 0.5 * math.sin(k)}, 3 if k in HAND_FRAMES else "neutral", hand=k in HAND_FRAMES) for k in range(10)])
_clip(root / "jump", [draw({"dy": dy}) for dy in JUMP])
- _clip(root / "turn", [draw(mouth=mouth, turn={"dx": 12 * w, "th": -5 * w}) for w, mouth in zip(TURN, TURN_MOUTH)])
+ _clip(root / "turn", [draw({"th": -5 * w}, mouth, turn={"dx": 12 * w, "th": -5 * w}) for w, mouth in zip(TURN, TURN_MOUTH)])
rows = ["frame\tt_s\tstate\tsound"]
for k, mouth in enumerate(GREET):
state = "closed" if mouth in ("neutral", "smile") else "open"
diff --git a/tests/video/test_face_layer.py b/tests/video/test_face_layer.py
index cec572e..0a15891 100644
--- a/tests/video/test_face_layer.py
+++ b/tests/video/test_face_layer.py
@@ -127,9 +127,9 @@ def test_size_and_tilt_are_read_with_the_place(case):
def test_a_head_that_turns_is_placed_where_its_mouth_is(case):
- """A head that turns moves its hair, headset and cheeks further than its mouth: the band reads them moved and tilted,
- and its place would carry the layer off the mouth. Size and tilt stay the band's; the place is read on the skin
- round the frame's closed mouth, and a frame whose mouth is open takes the move of the closed frames round it."""
+ """A head that turns moves its hair, headset and cheeks further than its mouth: the band reads them moved, and its
+ place would carry the layer off the mouth. Size and tilt stay the band's; the place is read on the skin round the
+ frame's closed mouth, and a frame whose mouth is open takes the move of the closed frames round it."""
_, pack = case
rows = [anchor(six) for six in body(pack, "turn")["to_body"]]
for k, (w, mouth) in enumerate(zip(tf.TURN, tf.TURN_MOUTH)):