W3C home > Mailing lists > Public > www-style@w3.org > September 2013

Re: [css-shapes] circle radius as a percentage

From: Alan Stearns <stearns@adobe.com>
Date: Thu, 5 Sep 2013 15:57:16 -0700
To: François REMY <francois.remy.dev@outlook.com>, "www-style@w3.org" <www-style@w3.org>
CC: Laurence Mclister <lmcliste@adobe.com>
Message-ID: <CE4E5974.3E183%stearns@adobe.com>
On 9/5/13 3:49 PM, "François REMY" <francois.remy.dev@outlook.com> wrote:

>Some clarification of the css-shapes-1 spec (regarding how to interpret a
>percentage value used as a circle radius) would be welcome, I guess, for
>people trying to implement the spec.
>
>Indeed, it seems to me it is not specified whether the percentage is
>considered from the width direction or from the height direction, or form
>any other kind of reference. My own implementation used the width
>direction for consistency with ellipse but it would probably just be
>better to disallow percentage-defined radius for circles.
>
>Relevant text from the spec:
>
>  circle([<length>|<percentage>][, [<length>|<percentage>]]{2})
>  
>  The three values values represent cx, cy, and r.
>  They define the x-axis and y-axis coordinates of the center of the
>circle and the radius of the circle.
>  A negative value for r is invalid.
>
>For what it's worth, I'm not quite sure why there's a need for circle
>function when we could simply consider as a circle an ellipse with 3
>arguments, but I guess it's for the sake of consistency with SVG.
>
>Best regards,
>Francois 		 	   		

Look at the last sentence of section 3.2:

---
For the radius r of the circle shape,
a percentage value is resolved as
specified in the SVG recommendation.
---

The relevant part of the SVG rec is:

---
For any other length value expressed
as a percentage of the viewport,
the percentage is calculated as
the specified percentage of
sqrt((actual-width)**2 +
      (actual-height)**2))/sqrt(2).

---

Thanks,

Alan
Received on Thursday, 5 September 2013 22:57:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:34 UTC