Masks and layers

Draw an Ebi shape into a transparent texture to make a mask. The mask on the left keeps the center of the checkerboard. The orange square is composited over the result at a pixel offset. Edit Overlay opacity to see the layers underneath.

Loading Ebi…
let tile = Texture(size=[2,2], pixels=[Color("blue5"), Color("blue2"), Color("blue2"), Color("blue5")])
let pattern = tile.resize(size=[16,16], filter="nearest").tile(size=[96,96])
let mask = Texture(size=[96,96]).draw(
    <Box w-54 h-54 rounded-full fill="white" x_align={Align.Center} y_align={Align.Center}/>
)
let opacity: Number<0, 1, 0.05> = reflect(0.8, label="Overlay opacity")
let accent = Texture(size=[24,24], fill=Color("orange3")).with_alpha(alpha=opacity)
let layered = pattern.mask(mask=mask).composite(over=accent, at=[56,56])

<Image src={mask} width={160pt} position={[-96pt,0pt]}/>
<Image src={layered} width={160pt} position={[96pt,0pt]}/>
wait(3s)

mask takes a texture of the same size. Its default channel is alpha. Select channel="luma" to use brightness instead. composite accepts an overlay of a different size and clips it to the base. More color and composition operations