Re: Linear gradients, Transforms and angles...

On Sep 26, 2010, at 1:05 PM, Chris Marrin <cmarrin@apple.com> wrote:

> 
> On Sep 23, 2010, at 5:48 PM, Brad Kemper wrote:
>>> ...
>>> I have no idea what you mean by this.  We're talking about an element rotated by X, and an element with a gradient rotated by X.  Not radial gradients.
>> 
>> Linear gradients. The thing about them is that they are linear. As in "line". A straight direction. They are therefore different from, say, 'transform:rotate()' in which something is actually rotated. Most authors will not think of a 45deg linear gradient as being a left-right angle that has been rotated 45deg. It is just a direction, a straight direction. NOT something that has been rotated. That direction is measured in degrees because it can be thought of as a ray pointing outward from it's starting point, as if you centered a protractor on that point. There is a relative distance of circular arc that (when measured in degrees) tells you what direction the ray is pointing, but the ray itself is one-dimensional in its direction, unlike an actual rotation. 
>> 
>> So just because linear directions and rotations both are measured in degrees does not mean that you can't intuitively have positive numbers mean clockwise for _rotations_, but still follow the standard geometry convention for specifying _linear_ direction.
> 
> It's taken me a while to realize that you're not suggesting we change the definition of ALL rotations to be counter-clockwise, just the direction of gradients, is that right?

Yes. 

> If so, then you must believe "linear direction" is somehow fundamentally different from "rotation" to make the inconsistency reasonable.

Yes. I think most people would consider a linear direction (like "north", "left", "starboard", "up", etc.) to be a single, 2-dimensional direction, and not a rotated anything. Whether you say it as "bottom to top" or "90deg", you are still talking about the same linear (not rotated) direction. The difference is that "90deg" only makes sense if you know what direction zero degrees is (an idea that is totally divorced from the idea of rotating), and which way the other linear directions progress. Those numbered degrees are labels on a circle, as surely as "bottom" and "top" are labels on a rectangle when you say "bottom to top", but can also be subdivided into decimals. . 

> II understand the argument, but I disagree with it. If we are trying to make HTML "author friendly" there are many ways to do that. One is to use concepts familiar to authors, so making angles behave in a way that authors are familiar with is a good criteria. But another is to lower the level of knowledge and experience and author needs. And another is to make the concepts consistent. I think having the angle of linear direction and rotations behave the same achieves those last two criteria.

They are not the same, and the behavior is not the same. Only the degree itself is the same; it is just a measure of arc, without direction. We don't treat positive values of "inches" as though the have to go in the same direction for all properties that measure things horizontally. So why should we treat degrees as though they should always be arrayed clockwise, simply because that is the direction for rotations?

> I have a lot of experience in dealing with geometric concepts and the idea that rotating a box and supplying a direction vector for gradients are two fundamentally different things just doesn't make sense to me. For me the visual model for rotating a box is to start with a piece of axis aligned paper on a desk, grab it and spin it until it is at the correct angle.

I believe this reflects your experience as an implementer, not as an author. When I say "bottom to top" or "north" or "on your six [o'clock position]" you don't need to imagine anything spinning, do you? To me, the reason for using degrees has nothing whatsoever to do with rotation. It is because it has the familiar reference for linear directions (protractors and high school math diagrams), and can take decimal subdivisions in a way that bg-position can't (and it's simpler to write).  But the familiarity of it to anyone who has used a protractor, or who has used a graphics program to numerically set a gradient, is one of the most important reasons for having angles as a way to specify linear direction. 

> For setting the direction of a gradient, I also start with a piece of axis aligned paper, this time with a nice color gradient on it, and spin it until the gradient is at the correct angle.

I feel that is a very unusual way to think of a linear direction for a gradient. 

> I don't see the difference. I don't think authors on the street will either.

I disagree. Adobe also seems to have disagreed when they picked a model for setting gradients in their software. 

> HTML really needs words in the various sections where we specify angles. Something like:
> 
> 	CSS Transforms specify angles as a clockwise rotation

Except that angles are not rotations, they are measurements of amount of arc. Rotations USE angles to measure how much to rotate. Angles are ALSO used differently, as reference points to measure the direction of rays. 

> about the selected axis. This is different from the counter-clockwise 
> 	rotations you may be used to from geometry class. The reason for this is because in the HTML coordinate space has the Y 
> 	axis going down rather than up because that how you (often) read a page of text. Since the Y axis is flipped, the direction of 
> 	rotation is flipped, too.

Something like that could work when you limit yourself you talking about measuring rotations using angles, instead of using them to measure linear direction. 

> If all angular motion is the same,

Linear direction is not the sane as rotational direction. One goes in the direction of a straight line, the other goes in the direction of a circle. 

> we can make this a general statement. If the angles used for gradient directions behave differently, we'll need yet another statement that says, "oh, for gradients angles are counter-clockwise unlike everything else". This gives authors yet another thing to remember.

I find it far more confounding to have to multiply the familiar way of specifying linear direction by -1, because of what I think of as a more dogmatic, esoteric, and unnatural way of thinking about linear direction. 

> I understand the advantages of your argument, I just think the consistency argument is stronger.

I still don't see anything inconsistent about a unit measuring arc being used differently to measure different things. No more so than position 'left' moves things in an opposite direction from position 'right' when using the 'in' unit. 

If we come down on the side of only using degrees for rotation only, and any other use has to be mentally converted into something that has been rotated, then that would be a travesty, IMO. 

Received on Monday, 27 September 2010 03:43:28 UTC