

RE: radial-gradient() proposal

From: David Perrell <davidp@hpaa.com>
Date: Sun, 6 Sep 2009 18:22:32 -0700
Tab Atkins Jr. wrote:
| It has nothing do with the axes of the ellipse; it specifies the angle
| of the gradient-line, which is used solely for placing color-stops.
| It is absolutely vital to know the direction of the gradient-line when
| position a color-stop with a <length>, because there's quite a bit of
| difference in where "yellow 50px" gets drawn on a 200px by 100px
| ellipse based on whether you're measuring down the major axis, the
| minor axis, or somewhere else entirely.

The significance of the gradient-line angle is not in question.

| If you know the width and height of the box, sure, though I'd prefer
| not to do any trig at all when creating my CSS files.

I'm noting that the browser can do the trig based on values known at render time. I'm trying to relieve the author of unnecessary decisions.

| K, good enough.

I'm arguing the contrary.

| > Closest-side, farthest-side, etc., are measured on a vertical 
| or horizontal line from the start-point to a side. Isn't that the 
| line on which you'll most likely want to align things? Consider 
| also that to-a-side and to-a-corner measurements represent the 
| longest lines on which all distances from 0-100% appear within the box.
| Not for ellipses; they measure a horizontal *and* vertical line to the
| two nearest sides.  There's no reasonable way to automatically
| distinguish between the two.

The ellipses don't measure anything, they are based on the criterion you've specified. Closest-side and farthest-side refer to *one* side except when two sides match that criterion. When they match, the direction of the gradient-line makes no difference because the ellipse is a circle.

| Similarly, for an ellipse the to-a-corner distance is, I think, rarely
| going to be a better choice than the major or minor axis.  Again, you
| can't reliably tell which is better automatically; this depends on
| your layout needs.

Consider your needs when you specify a 'cover' ellipse. Will <length> measurements be useful near the outside edge when you don't know the actual dimensions of the box? If so, wouldn't the longest visible distance be a better length reference?
| For circles, of course, these questions are all moot.  They align to a
| single side, and have only a single radius no matter what direction
| you're looking in.

Yes, of course. And if you're looking for analogues, consider that the analogue for a radial-gradient confined to horizontal and vertical axes is a linear-gradient confined to horizontal and vertical directions. A linear gradient is just a bisected radial gradient with an infinite radius. If you are precluding angular axes, you have no direct analogue for <angle>.
| Specifying angles *is* necessary, even if only to distinguish between
| 0deg and 90deg.  If I were to do this, I would use keywords like [
| horizontal | vertical | major | minor ] to specify which axis of the
| ellipse to measure along.  I'm not completely certain this is actually
| simpler, though.

Your to-a-side, to-a-corner sizing *does* specify an angle when an angle is needed.

David Perrell
Received on Monday, 7 September 2009 01:23:35 UTC
