-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-transforms-1] Error in prose describing order of multiple transform function #909
Comments
Need to also ensure that https://www.w3.org/mid/509FCC62.5080101@mit.edu is satisfied. |
I came here to express that this issue is causing confusion. This stackoverflow question illustrates that people are seeing the documentation and getting confused about the order of operations. |
I think the mental ordering you use depends on whether you're used to thinking about matrix math.
gives the same result as:
and since ancestors are painted before descendants, describing this in terms of the translate being applied first makes sense. Someone designing this in a tool would first translate, then scale, then rotate. |
Maybe, as suggested in https://lists.w3.org/Archives/Public/www-style/2011May/0633.html, the spec should talk more about how transforms affect coordinate systems, rather than coordinates. |
@smfr when you reverse the order of transformations, it becomes quite clear which order the transformations happen in. Take a look at this jsfiddle You can explain the blue shape arguably forward and backward, but you cannot explain the orange shape with forward application of the rules. |
How about something like this: -This transform moves the element by 80 pixels in both the X and Y directions, then scales the element by 150%, then rotates it 45° clockwise about the Z axis. Note that the scale and rotation operate about the center of the element, since the element has the default transform-origin of ''50% 50%''. |
I'm lost in row-major vs. column-major and pre- vs post-multiply confusion here. I think, if we consider the matrices to be in column-major order (which is indicated by the order of arguments to matrix() and matrix3d() that "concatenate" means post-multiply. I'm also confused by this figure in SVG: https://www.w3.org/TR/SVG/images/coords/MatrixMultiply.png where it talks about mapping from new to old coordinate systems with the column vector on the right. |
…the example to talk about transforming coordinate systems, rather than moving the element.
Prose updated, but still needs mathy edits. |
Add a paragraph to Module Interactions to reference computation of scrollable overflow w3c/csswg-drafts@2096ecf0c07388008ecb31363b8a8 3d941db1127 Use UA style instead of prose to handle the exception of transform-origin for SVG w3c/csswg-drafts@dec1a83d199a6b0cf81539fb2bdfc 4a99e0de190 Change one occurrence of <percentage> to <length-percentage> w3c/csswg-drafts@26444582dcaac7f1ef9f9b60044d6 9f8a76534a5 Per issue 857, change the initial value of transform-box to view-box. w3c/csswg-drafts@861a54a2bcec16613ab7dfd03cd77 35ab8da8fd4 Attempt to address some of issue w3c/csswg-drafts#909 by changing the example to talk about transforming coordinate systems, rather than moving the element. w3c/csswg-drafts@73ee670a655a34032d78b16a2ba49 e32f79dcff1 Incorrect autolinking of "transform" w3c/csswg-drafts@ed0f4268e7cf2dee5ac896fb8f5eb de2c690a0d6 (和訳には織り込み済み)
I am adding the definition of pre-multiply, post-multiply and multiply from Geometry to CSS Transforms. The graphics that @smfr mentions tries to explain where any point in the coordinate space of a transformed element actually would be in the elements parent coordinate space. I agree that this might not be obvious on the first view. The same way, the nested transform section shows how any point in the coordinate space of an element can be transformed (by post-multiplying all subsequent transformations) into the coordinate space of any ancestor element. Example 4 is example 3 now. I changed the text a little bit so that it obvious that the first sentence is explaining how the result looks like visually. The complicated part is the part about "rendering". I think here we should do the same as SVG does and explain (maybe with formulas in a normative section) how any point in the current coordinate space can be mapped to the coordinate space of an ancestor. The section that @smfr mentions with "inside out" should be changed to reflect what SVG says. I am going to do some edits and put it for review into the spec. Though, post-multiplied is specified now, I need to go over the individual instances to check that the terms are used correctly. I am unsure about that currently. |
…iply and multiply. Clean up examples and editorial changes. #909
Ok, just did the math. The reverse transform list is exactly the wrong way. Should be:
Will do the edits tomorrow. |
…iply and multiply. Clean up examples and editorial changes. w3c#909
…g (and referencing) post-multiply/pre-multiply. #909
Multiplication order in general should be clarified in the spec now. Leaving the issue open for now because I am considering to pull back more math from SVG 1.1. |
Did add clarification The Transform Rendering Model. Please review. |
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29110:
http://www.w3.org/TR/2013/WD-css-transforms-1-20131126/#transform-rendering
states in Example 4:
| transform: translate(80px, 80px) scale(1.5, 1.5) rotate(45deg);
| }
|
| This transform moves the element by 80 pixels in both the X and Y directions,
| then scales the element by 150%, then rotates it 45° clockwise about the Z axis.
This is technically incorrect. It should read
"This transform rotates the element 45° clockwise about the Z axis, then scales the element by 150%, then moves it by 80 pixels in both the X and Y directions."
And further:
| Note that the scale and rotation operate about the center of the element,
| since the element has the default transform-origin of 50% 50%.
This is very misleading in this context, since it implies that the translation affects the transform-origin too, which it doesn't.
Similar issue in http://www.w3.org/TR/2013/WD-css-transforms-1-20131126/#transform-function-lists :
| [...] a nested set of transforms is equivalent to a single list of transform functions,
| applied from the outside in.
I'm not sure what that even means. Would "applied from the inside out" be more appropriate?
Mathematically, we're talking about the fact that for all x, we have (f o g)(x) == f(g(x)). Now, are we applying f and g "from the inside out" or "from the outside in"? Or is there a better way to put it? I feel like there should be.
The text was updated successfully, but these errors were encountered: