Files
8bitMyGoUI/fx/scanlines.go
T
ZacharyZhang-NY 8be66c09f2 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.
2026-10-12 04:05:25 -04:00

24 lines
537 B
Go

package fx
import (
"github.com/egoist/mygo/ui"
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
)
type ScanlinesOptions struct {
// Slot shades the rows; zero means Shade.
Slot pixel.Slot
}
// Scanlines shades every other row of content at half strength.
func Scanlines(c *ui.Context, o ScanlinesOptions, content func()) *ui.Element {
k := pixel.K(c)
s := slotOr(o.Slot, pixel.Shade)
return cover(k, ui.Column(c), func(g pixel.Canvas) {
for y := 1; y < g.H; y += 2 {
g.Checker(0, y, g.W, 1, s)
}
}, content)
}