Skip to main content
.mask(image: Image): Component;

Parameters

image
Image
The image to use as a mask. The alpha channel of this image determines the visibility of the masked view.

Support

Usage

Image mask

Rectangle()
    .fill(Color("blue"))
    .mask(Image("star-mask.png"))

Text as mask

LinearGradient({ colors: [Color("red"), Color("blue")] })
    .mask(Text("MASKED").font("largeTitle").bold())

Shape mask

Image("photo.jpg")
    .mask(Circle().fill(Color("black")))