W3C home > Mailing lists > Public > www-style@w3.org > July 2009

Re: [css3-transitions] animation of color values should mention premultiplication

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 15 Jul 2009 11:24:44 -0700
To: www-style@w3.org
Message-ID: <20090715182444.GA11521@pickering.dbaron.org>
On Wednesday 2009-07-01 16:48 -0700, L. David Baron wrote:
> http://dev.w3.org/csswg/css3-transitions/#animation-of-property-types-
> currently says:
>   # color: interpolated via red, green, blue and alpha components
>   # (treating each as a number, see below). 
> This bullet point should probably mention that the red, green, and
> blue values should NOT be premultiplied with the alpha.  (I think
> that's the correct behavior, anyway.)

Actually, I'm not so sure this is correct (although WebKit's
implementation does do non-premultiplied).

I wrote a testcase:
(also attached) and I think it looks better with premultiplied
colors, although authors have less control.  (It's the first case
that I'm particularly concerned about.)

If I do premultiplication before interpolation, all of the first
three tests look the same.  If I don't, only the second one looks
"right"; the first and third show colors other than red (black and
green respectively) in the intermediate stages.  The fourth test is
the same either way; the fifth crosses through yellow hue more
quickly if I do premultiplication.

There is a control tradeoff here (giving authors more control versus
doing the right thing in more cases).  I think it's simpler if
authors get the right thing when they animate 'transparent' to 'red'
rather than having to specify 'rgba(255, 0, 0, 0)' to 'red', though.


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Wednesday, 15 July 2009 18:25:20 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:27 UTC