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

+18
View File
@@ -278,6 +278,24 @@ func TestReadyGoReportsDoneAfterAJump(t *testing.T) {
}
}
func TestShakeSpendsCuesUnderReduceMotion(t *testing.T) {
clk, cue := newClock(), 0
tt := view(300, 100, clk, false, func(c *ui.Context) {
feedback.Shake(c, feedback.ShakeOptions{Cue: cue}, func() {
ui.Box(c).Size(20, 20).Label("box")
})
})
x := find(t, tt, "box").X
tt.SetPreferences(ui.Preferences{ReduceMotion: true, TextScale: 1})
cue++
tt.Frame()
tt.SetPreferences(ui.Preferences{ReduceMotion: false, TextScale: 1})
tt.Frame()
if find(t, tt, "box").X != x {
t.Fatal("a cue spent under Reduce Motion shook later")
}
}
func TestShakeJoltsUnlessReduced(t *testing.T) {
for _, reduce := range []bool{false, true} {
clk := newClock()
+1 -4
View File
@@ -18,9 +18,6 @@ var shakes = [...]int{2, -2, 2, -2, 1, -1, 0}
func Shake(c *ui.Context, o ShakeOptions, content func()) *ui.Element {
k := pixel.K(c)
e := ui.Box(c)
dx := 0
if step := k.Since(c, k.Cue(e, o.Cue), 20, len(shakes)-1); !k.Reduce() {
dx = shakes[step]
}
dx := shakes[k.Shot(c, e, o.Cue, 20, len(shakes)-1)]
return e.Padding(0, k.D(2-dx), 0, k.D(2+dx)).Children(content)
}