mirror of
https://github.com/donlucasx/xscapes.git
synced 2026-10-20 08:43:32 +02:00
His ask of 2026-09-15: "the companion by itself (instead of within the scene), so it reads cleaner and more focused on what we are showing. Every 'state' should be toggable like right now, but should only showcase the companion, and its states. Same for 'a layer, not a screen', where it should feature all companions we have drafted thus far (crab, cat, owl, frog)" -- and on the first build, "no background whatsoever. The companion can be a tad smaller and 'float' on the site". - portraitFrames renders one animal on a ground the page writes as TRANSPARENT (HTMLPalette.Transparent, a sentinel no scene paints): no sea, no sand, no litter, no window box. The five legend states are still folded from the session, so the pose is the reducer's; the cast holds Working. The drawn box is centred at every rung, and the balloon's pointer is moved over the head (portraitBubble) instead of the beach's shoulder pointer, which clamped 16 cells off a centred crab in a 48-cell frame. 17 rows so the biggest rung's legs are not cut, which on a transparent ground reads as amputation, not a crop. - The cast: crab, cat, owl (scenes.DrawOwlPicked) and frog (scenes.DrawCandidate), each 18x9, working, blinking once a loop, a name and one line under each. Replaces the crab/cat switcher. - gifFrames' session stepping is sessionRun now, shared with the portraits; all ten existing clips fingerprinted byte-identical across the refactor. - The page: portrait stages cap the cell at 13px and snap it to whole pixels (fractional cells showed hairline seams through flat colour); drawBox no longer draws a right label it had decided did not fit; the cast grid's columns are minmax(0,1fr) so a max-content frame cannot widen them off the page. Nine portraits cost 5 KB gzipped; the page is 435 KB. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package scenes
|
|
|
|
import (
|
|
"github.com/donlucasx/xscapes/internal/canvas"
|
|
"github.com/donlucasx/xscapes/internal/companion"
|
|
)
|
|
|
|
// The study companions drawn on their own, for the page's cast. The crab and
|
|
// the cat draw themselves (companion.Cat.Draw); these two have no motion of
|
|
// their own, so a blink is the one thing a portrait can give them.
|
|
|
|
// DrawOwlPicked draws the owl as picked -- OwlPick in OwlCoat -- with its
|
|
// top-left cell at x, y. blink closes its eyes: the eye cells take the face's
|
|
// pale colour with a lid drawn on the lower row.
|
|
func DrawOwlPicked(c *canvas.Canvas, x, y int, blink bool) {
|
|
alt := &OwlAlts[OwlPick]
|
|
DrawOwl(c, alt, OwlCoat, x, y)
|
|
if !blink {
|
|
return
|
|
}
|
|
near := c.Near()
|
|
for _, ex := range []int{alt.eyeL, alt.eyeR} {
|
|
for r := 0; r < alt.eyeH; r++ {
|
|
g := ' '
|
|
if r == alt.eyeH-1 {
|
|
g = '-'
|
|
}
|
|
for k := 0; k < alt.eyeW; k++ {
|
|
near.PlotOn(x+ex+k, y+alt.eyeRow+r, g, owlDark, owlLight, 1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// DrawCandidate draws a study companion through the cat's pipeline with its
|
|
// top-left cell at x, y. blink closes its eyes.
|
|
func DrawCandidate(c *canvas.Canvas, a *Animal, x, y int, faceLeft, blink bool) {
|
|
glyph := a.eyeGlyph
|
|
if blink {
|
|
glyph = '-'
|
|
}
|
|
drawAnimal(c.Near(), a.body, 24, 28, a.Name, companion.Coats[a.Coat],
|
|
a.eyes, a.eyeRow, glyph, a.nose, a.noseRow, x, y, faceLeft)
|
|
}
|