Re: in-between values

On Feb 1, 2011, at 10:48 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

> On Tue, Feb 1, 2011 at 10:25 AM, Simon Fraser <smfr@me.com> wrote:
>> On Feb 1, 2011, at 8:36 AM, Brad Kemper wrote:
>>> '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.
> 
> Yeah, I don't think it makes sense to have mid() work on anything
> that's not animatable.

Wait  Do you mean it is not possible to draw a box that is some midpoint in size and position between a border box and a padding box? Or changing the gap and/or dash size to get something in between a solid border and the dash/gap size of a normal 'dashed' border? I don't see why not. Maybe I am misunderstanding your "yeah". 

That's kind of the whole point, is to have a way of creating those midpoints in a well defined way, so that they can be used in animations and transitions.

Clearly there are some properties that still would not yield to this treatment ('float' comes to mind).  

> Put another way, the functionality/plumbing necessary to animate
> something is identical to what's necessary to do mid().  Do one, and
> you get the other for free.

Yes. 


> That said, mid() can make one thing easier - you can use mid() as the
> interpolated value during an animation rather than having to create
> some new syntax that specifies the intermediate form.

Exactly. 

> 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?
> 
> blend() might be a better name.

Meh. I don't feel strongly about that, but it doesnt seem like an improvement to me. 

Received on Tuesday, 1 February 2011 23:15:12 UTC