Wildlife: hamster and hamster wheel prefabs

Ported from the thaiai.lol easter egg (thaiai iso/hamster/lib/hamster.rhai);
the data-centre joke parts stay there.

- hamster (Animals): golden, grey or cream with a white belly, pink nose,
  ears and paws, buck teeth and whiskers; standing, running on the spot or
  asleep (eyes shut, z Z); n and spread like the herds; life size (about
  17 cm) at scale 1, up to 40 times.
- hamster_wheel (Animals): diameter (0.3 m life size, up to 12 m), running,
  A-frame stand or a cage-wall axle stub, fur colour. Running legs and the
  rungs are flipbooks of 4 poses, 0.1 s each; the spokes turn by a CSS
  rotation in a matrix that maps the wheel's plane onto the screen.
- draw_parts learns loft2 (two-tone lofts), eye and flip parts;
  place_parts scales and moves any part list; loft and loft2 share
  loft_rings (the other animals draw byte for byte as before).
- Things under 2 m are drawn ten times bigger in a group that scales them
  back (fine_begin / fine_end), so a life-size hamster keeps its shape on
  the drawing's 0.1-unit grid; sort boxes stay real size.
- The legs push back on the ground and swing forward lifted (the original
  lifted them on the way back).
- Theme: hamster, hamsterg, hamsterc, hamsterw, hamsterp, hwheel, hwhub,
  whisker and hamz in both palettes, materials, rules for eyes, whiskers,
  rims, spokes, hub, rungs and the z Z. Viewer CSS: iso-flip4,
  iso-wheelspin, iso-runbob, iso-zzz; beast edges take --bw (default .3).
- Test hamsters_run_in_wheels_from_every_side: no sort cycles in any
  rotation, flipbook counts, scaled groups, real-size sort boxes, tooltips.
- README, ROADMAP, SCRIPTING and the MCP instructions list them.
This commit is contained in:
grabowski committed 2026-10-27 16:39:43 +07:00
1 parent c8becc2e59
commit 9619d0f267
8 files changed
+609 -29

No files matched your search

+7
View File
@@ -145,6 +145,13 @@ turns while grazing, rabbits hopping; Birds and Butterflies as flocks (`swim` sh
out of step); Beehives with bees, Bush, Flowers (bed or meadow), Rocks, Log / stump.
`examples/country`, Country demo in the web Studio.
Hamsters (ported from the thaiai.lol easter egg): Hamster (golden, grey or cream, white underneath;
standing, running on the spot or asleep; life size or scaled up) and Hamster wheel (diameter, stand
or cage-wall axle, running or still). Running legs and the wheel's rungs are flipbooks of four
poses, 0.1 s each; the spokes turn by a CSS rotation in the wheel's plane. Things under 2 m are
drawn ten times bigger inside a group that scales them back, so a life-size hamster keeps its
shape on the drawing's 0.1-unit grid.
Routes (`routes.rhai`, `travel` primitive): cars, buses, motorbikes, cyclists, people, deer and
elephants along waypoints drawn point by point in the Studio (`shape: "path"`, `pts`); loops or
there and back, each way on its side of the line, rounded corners. Every straight piece is a
+19
View File
@@ -168,6 +168,25 @@ spread within `r` of the object, each facing its rotation give or take 70°,
each its own sprite. Flocks of birds, butterflies and bees use `swim` with a
`shape`.
Hamsters add three kinds of parts to `draw_parts`: `loft2` (a loft in two
colours: faces pointing down get the belly colour, see `loft2`), `eye` (a
shiny bead, or shut) and `flip` (a flipbook: one part list per pose, shown
0.1 s each in groups `iso-a iso-flip4 [iso-pose0]`, the step of the viewer's
light animation mode). `hamster_parts(run, sleep, n, np, delay, fur)` builds
one about 1.2 m long, `place_parts(parts, s, o)` scales and moves any part
list, and `s.hamster_at(x, z, size, run, sleep, fur, delay)` draws it
(`hamster_life()` = life size). `s.hamster_wheel(R, run, stand, fur, delay)`
draws a wheel with a hamster in it: the rungs join the wheel's two planes, so
they are a flipbook too, drawn behind or in front of the hamster pose by
pose; the spokes turn by CSS inside `vplane_g(ux, uy)`, a raw group mapping
a vertical plane onto the screen in metres.
Small things lose their shape to the drawing's 0.1-unit grid (2.5 cm): draw
them `fine_k(size)` times bigger between `s.fine_begin(x, y, z, fz, k, css)`
and `s.fine_end()` (a group that scales them back about the point), then set
the sort extent with `ext_reset()` and `ext_box()`. Screen-unit values
inside (stroke widths, `--bw` for the `beast` edges) are k times bigger too.
## Points (`pts`)
An object's `pts` are plan points relative to its x, y in its turned frame. A prefab that draws