Re: in-between values

On Feb 1, 2011, at 10:25 AM, Simon Fraser <> wrote:

> 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 <> 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?

No, the opposite, really. That it would allow more properties to be animatable, by providing some extrapolated midpoints between certain value that don't normally have them. 

There might also be times when you might want these mid-point values outside of an animation/transition. 

> 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.

The computed style in that case would be, at 1/4 of a second into the hover, "background-clip: mid(border-box, padding-box, 0.25)". That's the idea with this. Am I misunderstanding your point?

> 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?

I'm not sure that's better. That sounds like all the steps in-between, instead of just one. We could use 'in-between()', but I much prefer the just 3 letters of 'mid()'. 

Received on Tuesday, 1 February 2011 23:03:10 UTC