transform
perspective
Sets how far the viewer is from the z=0 plane; without it, 3D rotation reads as a flat scale, not depth.
import { perspective } from "@sdxc/u/transform";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.perspective() | css({ perspective: "800px" }) |
u.perspective(400) | css({ perspective: "400px" }) |
u.perspective("none") | css({ perspective: "none" }) |
u.perspective("50rem") | css({ perspective: "50rem" }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.perspective()Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.perspective())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.perspective())Signature
u.perspective(value?: number | (string & {}))