Function

@once

Evaluate the argument once and reuse the result for every cell. Random values inside are drawn a single time instead of once per cell.

Syntax

  • @once(<value>)

Each @once keeps its own value until the doodle is drawn again. A custom property on :doodle does the same, but @once keeps the value where it is used.

Examples

One hue for the whole grid, varying lightness per cell:

@grid: 6 / 60vmin _1px;
background: hsl(@once(@r(360)), 70%, @r(30%, 80%));

The same shape on every cell, chosen at random once:

@grid: 4 / 60vmin _2px;
background: #000;
@shape: @once(@p(star, heart, hexagon, drop));
rotate: @r(360deg);

See also