Function

@uw, @uh

The width and height of the doodle in pixels, kept up to date when it resizes.

Syntax

  • @uw, @uw(<operation>, ...)
  • @uh, @uh(<operation>, ...)

The values are unitless numbers. Both take the same operations as @i, so @uw(*1px) is a length. Divide by them for a 0–1 ratio, the same role as a resolution uniform in a shader. Percentages on a cell are of that cell; these are the size of the doodle.

Examples

Angle from the center, in the same pixel space:

@grid: 8 / 60vmin;
background: #000;
@size: 55%;
margin: auto;
rotate: atan2(
  calc((@y - .5) / @Y * @uh - @uh / 2),
  calc((@x - .5) / @X * @uw - @uw / 2)
);

See also