Re: [css3-values] More "random" issues

On Wed, Oct 12, 2011 at 5:53 AM, Bert Bos <bert@w3.org> wrote:
> An idea for the "Values and units" module: random values.
>
> (For the record: The idea is due to a colleague of mine, François
> Daoust.)
>
> Properties with numeric (real) values are probably easiest to give
> random values, e.g., like this:
>
>    P { margin-left: calc(2em + random * 1em) }
>    SPAN { transform: rotate(calc(random * 6deg - 3deg)) }

Adding randomness to the language would be useful and cool, but it
exposes details of value computation that haven't yet been necessary
to define.

For example, in the following styles:

foo       { width: calc(random * 100px + 100px); }
foo:hover { width: 200px; }

What is the width of the element after hovering and unhovering?  Does
it keep the original value, or does it compute a new random value?

Does it make a difference if the rule kept applying the whole time
versus the rule not applying part of the time?  For example, with
these styles:

foo       { width: 200px; }
foo:hover { width: calc(random * 100px + 100px); }

What is the width of the element after hovering, unhovering, and hovering again?

We could probably avoid these issues by instead hooking randomness
into variables, and say they're calculated once (unless you mess with
their values), but then you couldn't do something like:

foo { width: calc(random * 100px + 100px); }

...and have all the <foo> elements get different random widths.

~TJ

Received on Wednesday, 12 October 2011 15:03:13 UTC