Skip to content

Commit cf147b7

Browse files
committed
[css-transforms-2] First draft of the translate/rotate/scale properties.
1 parent 12903f2 commit cf147b7

1 file changed

Lines changed: 86 additions & 2 deletions

File tree

css-transforms-2/Overview.bs

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,99 @@ Abstract:
1515
Abstract: This is a delta spec over CSS Transforms Level 1, while that spec is finishing standardization.
1616
</pre>
1717

18+
<pre class="link-defaults">
19+
spec:css-2d-transforms-1;
20+
type:property; text:transform
21+
type:dfn; text: transformation matrix
22+
</pre>
23+
24+
<!-- WTF, why does Bikeshed only shows these as existing the TR-level obsolete css-2d-transforms-1 draft? -->
25+
1826
Introduction {#intro}
1927
=====================
2028

2129
Introduction here.
2230

2331

32+
Individual Transform Properties: the 'translate', 'scale', and 'rotate' properties {#individual-transforms}
33+
===========================================================================================================
2434

25-
Issue: Per <a href="https://lists.w3.org/Archives/Public/www-style/2015Mar/0371.html">https://lists.w3.org/Archives/Public/www-style/2015Mar/0371.html</a>,
26-
the WG resolved to add 'translate', 'scale', and 'rotate' properties.
35+
Fluff here.
36+
37+
<pre class="propdef">
38+
Name: translate
39+
Value: [ <<length>> | <<percentage>> ] [[ <<length>> | <<percentage>> ] <<length>>? ]?
40+
Initial: 0
41+
Inherited: no
42+
Percentages: relative to the width of the containing block (for the first value) or the height (for the second value)
43+
Media: visual
44+
Computed Value: as specified, with lengths made absolute
45+
Animatable: as <<length>> or <<percentage>> list
46+
</pre>
47+
48+
<pre class="propdef">
49+
Name: rotate
50+
Value: <<angle>> <<number>>{3}?
51+
Initial: 0deg
52+
Inherited: no
53+
Media: visual
54+
Animatable: as SLERP
55+
</pre>
56+
57+
<pre class="propdef">
58+
Name: scale
59+
Value: <<number>>{1,3}
60+
Initial: 1
61+
Inherited: no
62+
Media: visual
63+
Animatable: as <<number>> list
64+
</pre>
65+
66+
The 'translate', 'rotate', and 'scale' properties
67+
allow authors to specify simple transforms independently,
68+
in a way that maps to typical user interface usage,
69+
rather than having to remember the order in 'transform'
70+
that keeps the actions of ''transform()'', ''rotate()'' and ''scale()''
71+
independent and acting in screen coordinates.
72+
73+
The 'translate' property accepts 1-3 values,
74+
each specifying a translation against one axis,
75+
in the order X, Y, then Z.
76+
Unspecified translations default to ''0px''.
77+
78+
The 'rotate' property accepts an angle to rotate an element,
79+
and optionally an axis to rotate it around,
80+
specified as the X, Y, and Z lengths of an origin-anchored vector.
81+
If the axis is unspecified,
82+
it defaults to ''0 0 1'',
83+
causing a "2d rotation" in the plane of the screen.
84+
85+
The 'scale' property accepts 1-3 values,
86+
each specifying a scale along one axis,
87+
in order X, Y, then Z.
88+
Unspecified scales default to ''1''.
89+
90+
91+
Current Transformation Matrix {#ctm}
92+
====================================
93+
94+
The <a>transformation matrix</a> computation is amended to the following:
95+
96+
The transformation matrix is computed from the 'transform', 'transform-origin', 'translate', 'rotate', 'scale', and 'motion' properties as follows:
97+
98+
1. Start with the identity matrix.
99+
2. Translate by the computed X, Y, and Z values of 'transform-origin'.
100+
3. Translate by the computed X, Y, and Z values of 'translate'.
101+
4. Scale by the computed X, Y, and Z values of 'scale'.
102+
5. Rotate by the computed <<angle>> about the specified axis of 'rotate'.
103+
6. Translate and rotate by the transform specified by 'motion'.
104+
7. Multiply by each of the transform functions in 'transform' from left to right.
105+
8. Translate by the negated computed X, Y and Z values of 'transform-origin'.
106+
107+
108+
109+
More Issues {#more-issues}
110+
==========================
27111

28112
Issue: Per <a href="https://lists.w3.org/Archives/Public/www-style/2015Mar/0371.html">https://lists.w3.org/Archives/Public/www-style/2015Mar/0371.html</a>,
29113
the WG resolved to add a formula for decomposing a transform into a unified "scale"

0 commit comments

Comments
 (0)