Add fx components 291-320 and the home scene; Kit.Shot, Kit.Toward

Palette cycling, sky, sun and moon, clouds, starfield, rain, snow,
petals, leaves, fireflies, waterfall, ocean, campfire, lava, aurora,
lightning, mountains and a season scene; scanlines, vignette, screen
shake, flash, dither fades, iris wipes, dissolves, mosaics, glitches,
sparkles, explosions and confetti. Home opens on a live scene in the
palette's season and a strip of all eight palettes.

pixel adds Canvas.Cycled, Sprite.At, SpriteOf, Kit.Toward and
Kit.Shot, which spends a cue under Reduce Motion so it never replays;
display exports Reduce. Gallery grids and the sidebar are one Tab
stop each.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-12 04:05:25 -04:00
1 parent 86a6901333
commit 8be66c09f2
56 files changed
+3324 -101

No files matched your search

+36
View File
@@ -71,6 +71,42 @@ func cell(c byte) int8 {
func (s *Sprite) Frames() int { return len(s.frames) }
// At is frame's slot at x, y; false where clear.
func (s *Sprite) At(frame, x, y int, ink Slot) (Slot, bool) {
if x < 0 || y < 0 || x >= s.W || y >= s.H {
panic(fmt.Sprintf("pixel: sprite dot %d,%d outside %d×%d", x, y, s.W, s.H))
}
n := len(s.frames)
switch v := s.frames[(frame%n+n)%n][y*s.W+x]; v {
case cellClear:
return 0, false
case cellInk:
return ink, true
default:
return Slot(v), true
}
}
// SpriteOf builds a one-frame sprite; at reports each dot.
func SpriteOf(w, h int, at func(x, y int) (Slot, bool)) *Sprite {
if w < 1 || h < 1 {
panic(fmt.Sprintf("pixel: sprite of %d×%d", w, h))
}
px := make([]int8, w*h)
for y := range h {
for x := range w {
px[y*w+x] = cellClear
if s, ok := at(x, y); ok {
if s >= Slots {
panic(fmt.Sprintf("pixel: sprite slot %d at %d,%d", s, x, y))
}
px[y*w+x] = int8(s)
}
}
}
return &Sprite{W: w, H: h, frames: [][]int8{px}}
}
// Mirror returns s flipped left to right.
func (s *Sprite) Mirror() *Sprite {
m := &Sprite{W: s.W, H: s.H}