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:
56 files changed
+3324
-101
No files matched your search
@@ -18,23 +18,39 @@ func fill(w, h int, c color.Color) *image.RGBA {
|
||||
return img
|
||||
}
|
||||
|
||||
// dots are a sprite's slots, -1 where clear.
|
||||
func dots(sp *pixel.Sprite) []int {
|
||||
var out []int
|
||||
for y := range sp.H {
|
||||
for x := range sp.W {
|
||||
s, ok := sp.At(0, x, y, pixel.Ink)
|
||||
if !ok {
|
||||
out = append(out, -1)
|
||||
continue
|
||||
}
|
||||
out = append(out, int(s))
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func TestReduce(t *testing.T) {
|
||||
pal := pixel.SpringDay
|
||||
a := pal.Colors[pixel.Accent]
|
||||
for _, s := range reduce(fill(8, 8, color.RGBA{a.R, a.G, a.B, 255}), 4, 4, pal) {
|
||||
if s != int8(pixel.Accent) {
|
||||
for _, s := range dots(Reduce(fill(8, 8, color.RGBA{a.R, a.G, a.B, 255}), 4, 4, pal)) {
|
||||
if s != int(pixel.Accent) {
|
||||
t.Fatalf("a flat Accent image gave slot %d", s)
|
||||
}
|
||||
}
|
||||
for _, s := range reduce(fill(4, 4, color.RGBA{}), 4, 4, pal) {
|
||||
for _, s := range dots(Reduce(fill(4, 4, color.RGBA{}), 4, 4, pal)) {
|
||||
if s != -1 {
|
||||
t.Fatal("a clear image drew")
|
||||
}
|
||||
}
|
||||
i, b := pal.Colors[pixel.Info], pal.Colors[pixel.Back]
|
||||
mid := color.RGBA{uint8((int(i.R) + int(b.R)) / 2), uint8((int(i.G) + int(b.G)) / 2), uint8((int(i.B) + int(b.B)) / 2), 255}
|
||||
seen := map[int8]int{}
|
||||
for _, s := range reduce(fill(16, 16, mid), 16, 16, pal) {
|
||||
seen := map[int]int{}
|
||||
for _, s := range dots(Reduce(fill(16, 16, mid), 16, 16, pal)) {
|
||||
seen[s]++
|
||||
}
|
||||
if len(seen) < 2 {
|
||||
|
||||
Reference in new issue
Block a user