1# pixel-mouth
2
3A mouth for pixel-art characters, as data and one pure function. A host describes where a character's
4mouth sits and how it is drawn (a [`MouthSpec`](src/lib.rs)) and asks for the rectangles of one of four
5openness levels (`Closed`, `Small`, `Wide`, `Round`); it draws them in its own grid. Nothing here knows
6what a character is, what a grid is drawn on, or which host asked.
7
8| Item | What it is |
9|---|---|
10| `MouthSpec` | The anchor in the host's grid, the size, the style and the colours the mouth draws with. |
11| `Style` | The animal's kind of mouth: `Cat` (a nose line and two steps when shut), `Flat` (a plain line when shut), `Muzzle` (cells under a nose, growing across or down), `BeakSide` (a lower beak that drops, on a character in profile), `BeakFront` (the opening under a beak seen from the front). |
12| `rects(spec, level)` | The rectangles to draw, in the host's grid units, in paint order. A level whose style adds nothing (a muzzle shut) is empty: the host's own picture is the closed mouth. |
13| `Level` | The four openness levels, how open each is (`open`), and the level nearest an openness (`level_for_open`). |
14| `level_for_vowel`, `level_in_syllable`, `OPEN_UNTIL` | The timing that steps the openness over a syllable: the vowel of the syllable being said chooses the level, and it shuts in the last of the gap before the next. |
15| `flap_open`, `flap_level` | The beat a mouth follows when nothing says which syllable it is on. |
16
17The levels are not drawn by a host: a character is a `MouthSpec` and nothing else, so a new character
18adds data and no code.
19
20```
21mise run test
22```