Skip to content

Butterfly kit (T1) - #132

Merged
joebywan merged 2 commits into
mainfrom
feat/butterfly-kit
Nov 19, 2026
Merged

joebywan merged 2 commits into
mainfrom
feat/butterfly-kit

Conversation

@joebywan

Copy link
Copy Markdown
Owner

T1 from docs/WINGBEAT.md. No app wiring.

  • src/cast/butterfly.js is the one drawer: the player's butterfly open (butterfly) and side-on (butterflySide), egg, caterpillar(growth), chrysalis, and any species from its spec (open, side). Wings are data-part="wings" and the body data-part="body", so garden/scene.js animateVisitor(el, 'butterfly') flaps them with no new motion code. The two halves now share one pair of clip paths, which keeps the full butterfly under 3 KB. tools/icon.js still runs, and the icon looks the same, so the generated icon files are left alone.
  • src/data/butterflies.json has 22 species: one for each course, practice habit and preset, and a pool of five for people's own habits (speciesFor(id, ownIndex)). Each field-guide line has its source (Australian Museum, Butterfly House, or Kyoto Prefecture for the Great Purple Emperor).
  • Habit colours (HABIT_COLOURS, OWN_COLOURS, habitColour) for the wing panels.
  • tools/butterflies.html shows every species open and side-on, the life cycle, and your butterfly at 0, 4, 9 and 14 panels, at 200, 96 and 48 px, in light and dark.
  • Tests: test/butterflies.test.js checks one species per raiser with no repeats, a source on every line, every drawing under 3 KB, and that the caterpillar grows. The guardrail lint now covers the field-guide lines.

Dark butterflies have a pale fringe on the wing edge, so they stay visible on dark backgrounds.

src/cast/butterfly.js now draws the player's butterfly open and side-on,
the egg, a caterpillar that grows, the chrysalis, and any species from its
spec, with wings and body as data-parts so the garden's flutter flaps them.
src/data/butterflies.json holds 22 species: one per course, practice habit
and preset, and a pool of five for habits people make, each with checked
field-guide lines and their sources. Habit colours for the wing panels.
tools/butterflies.html renders it all at 200, 96 and 48 px, light and dark.
The body, head and antennae (and the caterpillar's feelers) paint with
var(--butterfly-body), falling back to the ink; styles.css sets it pale for
dark. Each drawing takes an optional body colour for places with no CSS;
tools/icon.js passes the ink. The chequered swallowtail loses four spots to
stay under 3 KB.
@joebywan
joebywan merged commit 0f03c86 into main Nov 19, 2026
2 checks passed
@joebywan
joebywan deleted the feat/butterfly-kit branch November 19, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant