Re: in-between values

On Feb 1, 2011, at 8:36 AM, Brad Kemper wrote:

> On Feb 1, 2011, at 3:25 AM, timeless wrote:
> 
>> On Fri, Jan 21, 2011 at 7:54 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
>>> I had an idea for a special value that could be used with a variety of properties,
>>> for transitioning, animating, or just picking single values that are in between two
>>> values that don't normally have any mid-points. So for instance:
>> 
>>> background-clip: mid(border-box, padding-box, 0.24) /* would clip 1/4 of the way from border-box to padding-box */
>>> background-clip: mid(padding-box, border-box, 0.24) /* would clip 1/4 of the way from padding-box to border-box */
>> 
>> Isn't 1/4 usually 0.25? Why did you write 0.24, is there some magic going on?
> 
> Sorry. That must be a typo. It should have said 0.25.
> 
> 'background-clip: mid(border-box, padding-box, 0)' would be the same as 'background-clip: border-box'. 'background-clip: mid(border-box, padding-box, 1)' would be the same as 'background-clip: padding-box'. 

Is the intention that mid() should only for animatable properties? If so, "mid(border-box, padding-box, 0.25)" will not work, because you can't say:

div {
  transition: background-clip 1s;
  background-clip: border-box;
}
div:hover {
  background-clip: padding-box;
}

because "border-box" and "padding-box" aren't resolved to actual lengths in computed style. A similar argument applies if you try to say mid() with border-styles.

>>> color: mid(transparent, blue, 0.7) /* equivalent to color:blue; opacity:0.7 */
>>> color: mid(blue, transparent, 0.7) /* equivalent to color:blue; opacity:0.3 */
>> 
>> It took me a couple of readings to understand this. You aren't using
>> mid to mean 'midpoint'...
> 
> A midpoint yes, but not necessarily a halfway point. The number between 0 and 1 would indicate the position of the midpoint, with smaller numbers (0 – 0.5) being closer to the first value, and larger numbers (0.5 – 1) being closer to the second value.

I think mid() implies the half-way point too strongly. Maybe blend() would be more descriptive?

Simon

Received on Tuesday, 1 February 2011 18:25:42 UTC