W3C home > Mailing lists > Public > www-svg@w3.org > March 2011

Re: Animating mixed units

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 31 Mar 2011 09:09:40 -0400
Message-ID: <4D947D14.4010202@mit.edu>
To: Jérémie Patonnier <jeremie.patonnier@gmail.com>
CC: "www-svg@w3.org" <www-svg@w3.org>
On 3/31/11 6:01 AM, Jérémie Patonnier wrote:
> 1. I tried to animate from 0 pixel to 100% and it fails. If I try to animate from 0% (explicitly) to 100%, all browsers work fine. So the question is : What is the f*** difference between 0px and 0% ?

How it's stored internally by the UA, basically.

> This is amazingly confusing for author.

Agreed.

> I really think that in that case, the way Mozilla handle this is the best way for authors.

For what it's worth, the way this works in Mozilla is that animating 
from Npx to M% sets the style at time t to -moz-calc((1-t)*Npx + t*M%). 
  So once browsers generally support CSS calc() I would think they will 
also support interpolating between absolute lengths and percentages.  If 
you _don't_ have the infrastructure for calc(), this is a bit of a pain 
and there is no decent way to hack it in (with the exception you point 
out for 0% vs 0px, which could be special-cased).  In particular, 
getting things right in the case when the width against which the 
percentage is resolved were also time-varying while interpolating 
between a nonzero absolute length and a nonzero percentage basically 
requires the same machinery that calc() requires.

-Boris
Received on Thursday, 31 March 2011 13:10:17 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:47 GMT