W3C home > Mailing lists > Public > www-style@w3.org > February 2011

Re: in-between values

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 1 Feb 2011 10:48:15 -0800
Message-ID: <AANLkTimSL6QqT6UqN=QMvZsBB-pJXfoBp0TAXVHaeULE@mail.gmail.com>
To: Simon Fraser <smfr@me.com>
Cc: Brad Kemper <brad.kemper@gmail.com>, timeless <timeless@gmail.com>, www-style list <www-style@w3.org>
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.

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.

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.

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

Received on Tuesday, 1 February 2011 18:49:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:55 UTC