You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: fix this text to add to the text in CSS Transforms 1.
157
+
This specification extends [[css-transforms-1#transform-rendering]] to account for the existence of three-dimensional transform functions, the Z value of 'transform-orign', the 'perspective' property, and a new 3D rendering model that applies when the used value of the ''transform-style'' property is ''preserve-3d''.
158
158
159
-
Three-dimensional transform functions extend this coordinate space into three dimensions, adding a Z axis perpendicular to the plane of the screen, that increases towards the viewer.
159
+
Three-dimensional transform functions conceptually extend the coordinate space into three dimensions, adding a Z axis perpendicular to the plane of the screen, that increases towards the viewer.
160
160
161
161
<div class="figure">
162
162
<img src="images/coordinates.svg" width="270" height="240" alt="Demonstration of the initial coordinate space">
@@ -166,24 +166,26 @@ Three-dimensional transform functions extend this coordinate space into three di
166
166
</div>
167
167
168
168
<p id="transformation-matrix-computation">
169
-
The<a>transformation matrix</a> is computed from the 'transform' and 'transform-origin' properties as follows:
169
+
With 3D transforms, the Z component of 'transform-origin' affects the result, so the<a>transformation matrix</a> is computed from the 'transform' and 'transform-origin' properties as follows:
170
170
171
171
1. Start with the identity matrix.
172
-
2. Translate by the computed X, Y and Z of 'transform-origin'
173
-
3. Multiply by each of the transform functions in 'transform' property from left to right
174
-
4. Translate by the negated computed X, Y and Z values of 'transform-origin'
175
-
172
+
2. Translate by the computed X, Y and Z of 'transform-origin'
173
+
3. Multiply by each of the transform functions in 'transform' property from left to right
174
+
4. Translate by the negated computed X, Y and Z values of 'transform-origin'
176
175
177
176
3D Transform Rendering {#3d-transform-rendering}
178
177
----------------------
179
178
180
179
Normally, elements render as flat planes, and are rendered into the same plane as their stacking context. Often this is the plane shared by the rest of the page. Two-dimensional transform functions can alter the appearance of an element, but that element is still rendered into the same plane as its stacking context.
181
180
182
-
An element with a three-dimensional transform that is not contained in a <a>3D rendering context</a> renders with the appropriate transform applied, but does not intersect with any other elements. The three-dimensional transform in this case can be considered just as a painting effect, like two-dimensional transforms. Similarly, the transform does not affect painting order. For example, a transform with a positive Z translation may make an element look larger, but does not cause that element to
183
-
render in front of elements with no translation in Z.
181
+
An element with a three-dimensional transform that is not contained in a <a>3D rendering context</a> renders with the appropriate transform applied, but does not intersect with any other elements. The three-dimensional transform in this case can be considered just as a painting effect, like two-dimensional transforms. Similarly, the transform does not affect painting order. For example, a transform with a positive Z translation may make an element look larger, but does not cause that element to render in front of elements with no translation in Z.
182
+
183
+
Issue: describe how nested 3d-transformed elements render (perhaps with math)
184
184
185
185
<div class="example">
186
186
187
+
Issue: This example doesn't follow from the previous text.
188
+
187
189
This example shows the effect of three-dimensional transform applied to an element.
188
190
189
191
<pre>
@@ -211,10 +213,13 @@ This example shows the effect of three-dimensional transform applied to an eleme
211
213
The transform is a 50° rotation about the vertical, Y axis. Note how this makes the blue box appear narrower, but not three-dimensional.
212
214
</div>
213
215
214
-
215
216
### Perspective ### {#perspective}
216
217
217
-
The 'perspective' and 'perspective-origin' properties can be used to add a feeling of depth to a scene by making elements higher on the Z axis (closer to the viewer) appear larger, and those further away to appear smaller. The scaling is proportional to <var>d</var>/(<var>d</var> − <var>Z</var>) where <var>d</var>, the value of 'perspective', is the distance from the drawing plane to the the assumed position of the viewer's eye.
218
+
Perspective can be used to add a feeling of depth to a scene by making elements higher on the Z axis (closer to the viewer) appear larger, and those further away to appear smaller. The scaling is proportional to <var>d</var>/(<var>d</var> − <var>Z</var>) where <var>d</var>, the value of 'perspective', is the distance from the drawing plane to the the assumed position of the viewer's eye.
219
+
220
+
The appearance of perspective can be applied to a 3d-transformed element in two ways. First, the element's 'transform function list' can contain the ''perspective()'' function which computes into the element's 'current transformation matrix'.
221
+
222
+
Second, the 'perspective' and 'perspective-origin' properties can be applied to an element to influence the rendering of its 3d-transformed children, giving them a shared perspective that provides the impression of them living in the same three-dimensional scene.
218
223
219
224
<div class="figure">
220
225
<img alt="Diagram of scale vs. Z position" src="images/perspective_distance.png">
@@ -229,18 +234,14 @@ Normally the assumed position of the viewer's eye is centered on a drawing. This
229
234
<img alt="Diagram of different perspective-origin" src="images/perspective_origin.png">
230
235
<p class="caption">
231
236
Diagram showing the effect of moving the perspective origin upward.
232
-
233
237
</div>
234
238
235
239
<p id="perspective-matrix-computation">
236
240
The <a>perspective matrix</a> is computed as follows:
237
-
<ol>
238
-
<li>Start with the identity matrix.
239
-
<li>Translate by the computed X and Y values of 'perspective-origin'
240
-
<li>Multiply by the matrix that would be obtained from the ''perspective()'' transform function, where the length is provided by the value of the 'perspective' property
241
-
<li>Translate by the negated computed X and Y values of 'perspective-origin'
242
-
</ol>
243
-
241
+
1. Start with the identity matrix.
242
+
2. Translate by the computed X and Y values of 'perspective-origin'
243
+
3. Multiply by the matrix that would be obtained from the ''perspective()'' transform function, where the length is provided by the value of the 'perspective' property
244
+
4. Translate by the negated computed X and Y values of 'perspective-origin'
244
245
245
246
<div class="example">
246
247
@@ -267,7 +268,7 @@ This example shows how perspective can be used to cause three-dimensional transf
267
268
</pre>
268
269
269
270
<div class="figure">
270
-
<img src="examples/simple-perspective-example.png" width="210" height="190" alt="Div with a rotateY transform, and perspective on its container">
271
+
<img src="examples/simple-perspective-example.png" width="210" height="190" alt="Div with a rotateY transform, and perspective on its container">
271
272
</div>
272
273
273
274
The inner element has the same transform as in the previous example, but its rendering is now influenced by the perspective property on its parent element. Perspective causes vertices that have positive Z coordinates (closer to the viewer) to be scaled up in X and Y, and those further away (negative Z coordinates) to be scaled down, giving an appearance of depth.
@@ -283,7 +284,6 @@ The position of each element in that three-dimensional space is determined by ac
283
284
284
285
Elements establish and participate in 3D rendering contexts as follows:
285
286
286
-
287
287
* A <a>3D rendering context</a> is established by a <a>transformable element</a> whose used value for 'transform-style' is ''transform-style/preserve-3d'' and which itself is not part of a 3D rendering context. An element that establishes a 3D rendering context also participates in that context.
288
288
* An element whose used value for 'transform-style' is ''transform-style/preserve-3d'' and which itself participates in a <a>3D rendering context</a>, extends that 3D rendering context rather than establishing a new one.
289
289
* An element participates in a <a>3D rendering context</a> if its parent establishes or extends a <a>3D rendering context</a>.
0 commit comments