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

+27
View File
@@ -15,6 +15,8 @@ type Canvas struct {
k Kit
gx, gy int
W, H int
// remap swaps slots as they draw; nil keeps them.
remap *[Slots]Slot
}
// painter is what Canvas needs of *ui.Painter.
@@ -42,10 +44,35 @@ func (g Canvas) Rect(x, y, w, h int, s Slot) {
if w <= 0 || h <= 0 {
return
}
if g.remap != nil {
s = g.remap[s]
}
d := g.k.dot
g.p.Fill(ui.Rect{X: float32(g.gx+x) * d, Y: float32(g.gy+y) * d, W: float32(w) * d, H: float32(h) * d}, g.k.C(s), 0)
}
// Cycled draws band's slots where Cycle(band, step) moves them.
func (g Canvas) Cycled(band []Slot, step int) Canvas {
var m [Slots]Slot
for i := range m {
m[i] = Slot(i)
}
to := Cycle(band, step)
for i, s := range band {
if s >= Slots || slices.Index(band, s) != i {
panic(fmt.Sprintf("pixel: Cycled band %v repeats or overflows", band))
}
m[s] = to[i]
}
if g.remap != nil {
for i := range m {
m[i] = g.remap[m[i]]
}
}
g.remap = &m
return g
}
// Clip limits fn's drawing to a dot rectangle.
func (g Canvas) Clip(x, y, w, h int, fn func()) {
d := g.k.dot