effects
mask-image
Applies a CSS mask image, or the given subset of mask properties when passed an options object.
import { mask } from "@sdxc/u/effects";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.mask("linear-gradient(to bottom, transparent, black)") | css({ maskImage: "linear-gradient(to bottom, transparent, black)", WebkitMaskImage: "linear-gradient(to bottom, transparent, black)" }) |
u.mask({ image: "url(/badge.png)", size: "contain", position: "center", repeat: "no-repeat" }) | css({ maskImage: "url(/badge.png)", WebkitMaskImage: "url(/badge.png)", maskSize: "contain", WebkitMaskSize: "contain", maskPosition: "center", WebkitMaskPosition: "center", maskRepeat: "no-repeat", WebkitMaskRepeat: "no-repeat" }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.mask("linear-gradient(to bottom, transparent, black)")Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.mask("linear-gradient(to bottom, transparent, black)"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.mask("linear-gradient(to bottom, transparent, black)"))Signature
u.mask(image: string)