Property

@seed

Set the random seed from inside the code, so the doodle renders the same every time.

Syntax

  • @seed: <seed>
seed
Any value. It takes precedence over the seed attribute. Read the seed in use with the seed property.

A value with functions is evaluated once, before the rest of the code. $name reads a custom property with a plain value, and random functions draw from the seed the doodle already has.

Examples

@grid: 6 / 60vmin _1px;
@seed: 1234567;
background: @p(#000, #e6437d, #ebbf4d);
scale: @r(.5, 1);

The property is handy when sharing code: the recipient gets the exact image without touching the HTML. To find a seed you like, read it back with the seed property.

Inside a nested @doodle, random functions draw from the parent's seed, so @seed: @p(1, 2) gives each copy one of two seeds:

@grid: 4 / 60vmin _4px;
background: @doodle(
  @seed: @p(1, 2);
  @grid: 4 / 100%;
  background: @p(#000, #e6437d, #ebbf4d);
);

See also