-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathpart_10_transforms.html
619 lines (526 loc) · 26.1 KB
/
part_10_transforms.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
<!doctype html>
<html>
<head>
<!--[if gte IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<![endif]-->
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
<![endif]-->
<meta charset="utf-8" />
<title>Transforms || CSS: From Knowledgable to Ninja</title>
<!--link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'-->>
<link rel="stylesheet" href="css/screen.css" media="projection, screen"/>
<link rel="stylesheet" href="css/print.css" media="print"/>
<style>
.bug,.plane, .plane:after {
position:relative;
font-size: 100px;
color:#C7573A;
display:block;
height: 140px;
width: 140px;
border-radius: 7px;
line-height: 140px;
box-shadow: 5px 5px 0 5px rgba(0,0,0,0.2);
background-color: #fff;
margin:10px auto;
text-align:center;
font-size: 140px;
}
.plane:after {
content:'✈';
position:absolute; top: 0; left:0;
box-shadow: 5px 5px 0 5px #BDD9D5;
opacity: 0.9;
margin: 0;
pointer-events: none;
}
.plane_01:after {
transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
}
.plane_02:after {
transform:
translate(100px, 100px);
}
.plane_03:after {
transform:
rotate(90deg);
}
.plane_04:after {
transform:
scale(0.25, 0.75);
}
.plane_05,
.plane_05:after {
border-radius: 0;
border: 1px solid #666;
}
.plane_05:after {
transform:
skewX(15deg);
}
.plane_06:after {
transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
}
.plane_07:after {
transform: none;
}
.plane_08:after {
transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
}
.plane_09:after {
transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
}
.plane_10:after {
transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
}
section {padding-top: 20px;}
.x {width: 75%; float:right; margin:0; position:relative;}
.y {float: left; line-height:1.62em;}
#ABTrasform li {float: left; clear:both; list-style-type:none; width:100%;}
</style>
<style id="tempstyle"></style>
<style id="forBackfaceVisibility">
.backfacedemo{
-webkit-perspective: 1000;
-moz-perspective: 1000;
-ms-perspective: 1000;
-o-perspective: 1000;
perspective: 1000;
}
#backfacecube {
margin: 2rem 0 0 30%;
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
}
#backfacecube figure{
display: block;
position: absolute;
width: 196px;
height: 196px;
border: 1px solid #333;
line-height: 196px;
font-size: 120px;
font-weight: bold;
color: white;
text-align: center;
}
.cube figure{
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
#backfacecube .front{background: hsla(248, 100%, 50%, .5);}
#backfacecube .back{background: hsla(315, 100%, 40%, .5);}
#backfacecube .right{background: hsla( 48, 100%, 50%, .5);}
#backfacecube .left{background: hsla(125, 100%, 40%, .5);}
#backfacecube .top{background: hsla( 24, 100%, 50%, .5);}
#backfacecube .bottom{background: hsla(187, 87%, 50%, .5);}
#backfacecube .front {
-webkit-transform: rotateY( 0deg ) translateZ( 100px );
-moz-transform: rotateY( 0deg ) translateZ( 100px );
-ms-transform: rotateY( 0deg ) translateZ( 100px );
-o-transform: rotateY( 0deg ) translateZ( 100px );
transform: rotateY( 0deg ) translateZ( 100px );
}
#backfacecube .back {
-webkit-transform: rotateX( 180deg ) translateZ( 100px );
-moz-transform: rotateX( 180deg ) translateZ( 100px );
-ms-transform: rotateX( 180deg ) translateZ( 100px );
-o-transform: rotateX( 180deg ) translateZ( 100px );
transform: rotateX( 180deg ) translateZ( 100px );
}
#backfacecube .right {
-webkit-transform: rotateY( 90deg ) translateZ( 100px );
-moz-transform: rotateY( 90deg ) translateZ( 100px );
-ms-transform: rotateY( 90deg ) translateZ( 100px );
-o-transform: rotateY( 90deg ) translateZ( 100px );
transform: rotateY( 90deg ) translateZ( 100px );
}
#backfacecube .left {
-webkit-transform: rotateY( -90deg ) translateZ( 100px );
-moz-transform: rotateY( -90deg ) translateZ( 100px );
-ms-transform: rotateY( -90deg ) translateZ( 100px );
-o-transform: rotateY( -90deg ) translateZ( 100px );
transform: rotateY( -90deg ) translateZ( 100px );
}
#backfacecube .top {
-webkit-transform: rotateX( 90deg ) translateZ( 100px );
-moz-transform: rotateX( 90deg ) translateZ( 100px );
-ms-transform: rotateX( 90deg ) translateZ( 100px );
-o-transform: rotateX( 90deg ) translateZ( 100px );
transform: rotateX( 90deg ) translateZ( 100px );
}
#backfacecube .bottom {
-webkit-transform: rotateX( -90deg ) translateZ( 100px );
-moz-transform: rotateX( -90deg ) translateZ( 100px );
-ms-transform: rotateX( -90deg ) translateZ( 100px );
-o-transform: rotateX( -90deg ) translateZ( 100px );
transform: rotateX( -90deg ) translateZ( 100px );
}
.backfacedemo {
-webkit-perspective-origin: 50% -100px;
-moz-perspective-origin: 50% -100px;
-ms-perspective-origin: 50% -100px;
-o-perspective-origin: 50% -100px;
perspective-origin: 50% -100px;
-webkit-perspective: 500px;
-moz-perspective: 500px;
-ms-perspective: 500px;
-o-perspective: 500px;
perspective: 500px;
}
.backfacedemo {
-webkit-perspective: 1000;
-moz-perspective: 1000;
-ms-perspective: 1000;
-o-perspective: 1000;
perspective: 1000;
}
</style>
<style id="tempstyle">
</style>
</head>
<body>
<div id="topinfo">
</div>
<div id="info">
<p>
<span class="key">→</span> and <span class="key">→</span> to change slides.
<span class="key">2</span> for comments. <a href="http://estelle.github.com/CSS-Workshop">estelle.github.com/CSS-Workshop</a>
</p>
</div>
<div id="presentation">
<div id="presentation-counter"></div>
<div id="slides">
<div class="slide normal">
<header>
<h1 style="font-size:200%;">CSS: from Knowledgable to Ninja</h1>
</header>
<section class="content">
<p> ◈ Estelle Weyl</p>
<p> ◈ <a href="http://www.twitter.com/estellevw">@estellevw</a></p><p> ◈ <a href="http://www.standardista.com">www.standardista.com</a></p>
</section>
</div>
<!-- OUTLINE -->
<div class="slide normal">
<header><h1>Course Outline</h1></header>
<section class="content">
<ol><li><a href="../selectors/">Selectors</a></li>
<li><a href="part_02_specificity.html">Specificity</a></li>
<li><a href="part_03_generated.html">Generated Content</a></li>
<li><a href="part_04_media.html">Media Queries</a></li>
<li><a href="part_04_media.html#slide10">Debugging</a></li>
<li><a href="part_06_colors.html">Colors & Transparency </a></li>
<li><a href="part_07_fonts.html">Fonts / Typography </a></li>
<li><a href="part_08_backgrounds.html">Backgrounds & Borders </a></li>
<li><a href="../gradients/">Gradients</a></li>
<li><a href="part_10_transforms.html">Transforms</a></li>
<li><a href="../animation/">Transitions & Animation</a></li><li><a href="part_12_features.html">Other Features</a></li>
</ol>
</section>
</div>
<!-- Title Slide -->
<div class="slide intro">
<header><h1>Part 10: Transforms</h1></header>
<b class="bug">✈</b>
</div>
<!-- Title Slide -->
<div class="slide normal">
<header><h1>Tranforming Elements</h1></header>
<section class="content"><b class="plane plane_01">✈</b>
<pre contenteditable>.plane {
-webkit-transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
-moz-transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
-ms-transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
-o-transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
transform:
translate(-90px,300px) rotate(50deg) scale(.7,.9) skew(5deg);
}</pre>
<pre contenteditable>selector {
transform: none | <transFunc()> [<transFunc()>];
}</pre>
</section>
</div>
<div class="slide normal">
<header><h1>2D Transform Functions</h1></header>
<section class="content">
<dl class="deprecated listed wide">
<dt><strong>translate</strong>(<length>[, <length>])</dt>
<dd>specifies a 2D translation by the vector [x, y], where x is the translation-value parameter for the x axis and y is the optional translation value along the y axis. parameter. If <em>y</em> is not provided, y==0.</dd>
<dt><strong>translateX</strong>(<length>)</dt>
<dd>specifies a translation by the given amount in the X direction.</dd>
<dt><strong>translateY</strong>(<length>)</dt>
<dd>specifies a translation by the given amount in the Y direction.</dd>
<dt><strong>scale</strong>(<number>[, <number>])</dt>
<dd>specifies 2D scaling operation by the [sx,sy]. If sy is not provided, sy will equal sx (growsing or shrinking with the same scale). Scale(1, 1) or scale(1) leaves an element in it's default state. Scale(2, 2) or scale(2) causes the element to appear twice as wide and twice as tall as its default size, taking up 4-times the original area.</dd>
<dt><strong>scaleX</strong>(<number>)</dt>
<dd>specifies a scale operation using the [sx, 1] scaling vector, where sx is given as the parameter.</dd>
<dt><strong>scaleY</strong>(<number>)</dt>
<dd>specifies a scale operation using the [1, sy] scaling vector, where sy is given as the parameter.</dd>
<dt><strong>rotate</strong>(<angle>)</dt>
<dd>specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the <em>transform-origin</em> property. For example, rotate(90deg) would cause elements to appear rotated one-quarter of a turn in the clockwise direction.</dd>
<dt><strong>skewX</strong>(<angle>)</dt>
<dd>specifies a skew transformation along the X axis by the given angle.</dd>
<dt><strong>skewY</strong>(<angle>)</dt>
<dd>specifies a skew transformation along the Y axis by the given angle.</dd>
<dt><strong>matrix</strong>(<num>, <num>, <num>, <num>, <num>, <num>)</dt>
<dd>Generally machine generated, specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix <strong>[a b c d e f]</strong>.</dd>
</dl>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Translate</h1></header>
<b class="plane plane_02" data-style="transform">✈</b>
<section class="content">
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_02', this.innerText);">translate(100px, 100px)</span>;</pre>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_02', this.innerText)">translateX(100px)</span>;</pre>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_02', this.innerText)">translateY(100px)</span>;</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Rotate</h1></header>
<section class="content"> <b class="plane plane_03" data-style="transform">✈</b>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_03', this.innerText)">rotate(90deg)</span>;</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Scale</h1></header>
<section class="content"><b class="plane plane_04" data-style="transform">✈</b>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_04', this.innerText)">scale(0.25, 0.75)</span>;</pre>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_04', this.innerText)">scale(0.75)</span>;</pre>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_04', this.innerText)">scaleX(0.25)</span>;</pre>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_04', this.innerText)">scaleY(0.75)</span>;</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Skew</h1></header>
<section class="content">
<b class="plane plane_05" data-style="transform">✈</b>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_05', this.innerText)">skewX(5deg)</span>;</pre>
<pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_05', this.innerText)">skewY(5deg)</span>;</pre> <pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_05', this.innerText)">skewX(5deg) skewY(5deg)</span>;</pre> <pre contenteditable>transform: <span contenteditable onmouseout="setTempStyle('plane_05', this.innerText)">skew(5deg,5deg)</span>;</pre>
</section>
</div>
<div class="slide" id="gencontentlink">
<header><h1>Multiple Tranforms</h1></header>
<section class="content transform"><b class="plane plane_06" data-style="transform">✈</b>
<ul id="ABTrasform">
<li><b class="y">translate</b> <pre class="x">transform: <span contenteditable id="Atranslate">translate(-80px, 200px);</span></pre></li>
<li><b class="y">rotate</b> <pre class="x">transform: <span contenteditable id="Arotate">rotate(15deg);</span></pre></li>
<li><b class="y">scale</b> <pre class="x">transform: <span contenteditable id="Ascale">scale(1.5, 2);</span></pre></li>
<li><b class="y">skew</b> <pre class="x">transform: <span contenteditable id="Askew">skewX(-8deg);</span></pre></li>
<li>multiple transforms <pre>transform: <span contenteditable id="Btranslate">translate(-80px, 200px)</span>
<span contenteditable id="Brotate">rotate(-15deg)</span> <span contenteditable id="Bscale">scale(2, 1.5)</span> <span contenteditable id="Bskew">skewX(8deg)</span>;</pre></li>
</ul>
</section>
</div>
<script>
function setTempStyle(thisclass, change){
var temporaryStyleSheet = document.getElementById('tempstyle');
temporaryStyleSheet.innerHTML = '.slide .' + thisclass + '::after {-webkit-transform: '+ change +';transform: '+ change +';}';
console.dir(temporaryStyleSheet);
}
</script>
<div class="slide">
<header><h1>transforms</h1></header>
<section class="content">
<ul class="icons" style="clear: both;">
<li class="chrome">Chrome</li>
<li class="safari">Safari</li>
<li class="firefox">Firefox 3.5</li>
<li class="opera">Opera 10.5</li>
<li class="ie ">IE 9</li>
<li class="txt"> some with vendor prefix</li>
</ul>
<li>Vendor prefix -webkit and -ms</li>
<li>Transforms create a new stacking context</li>
<li>Take advantage of transform-origin</li>
<li>Multiple values are SPACE separated (no commas)</li>
<li><a href="http://westciv.com/tools/3Dtransforms/index.html">3D transforms</a> are hardware accelerated</li>
<li>Play with <a href="http://westciv.com/tools/transforms/index.html">Westciv's Transform Tool</a></li>
<li><a href="http://meyerweb.com/eric/tools/matrix/">Matrix</a> is another syntax</li>
<li>More about <a href="http://www.standardista.com/css3/css3-transform-property-and-the-various-transform-functions">transforms</a></li>
</section>
</div>
<!-- Play Time -->
<div class="slide object">
<header><h1>Play Time</h1>
<object data="files/100_simpletransforms.html"></object>
<a href="files/100_simpletransforms" target="play" class="objectlink">Try it out</a>
</div>
<div class="slide">
<header><h1>transform-origin property</h1></header>
<section class="content">
<p>Specifies the x and y position of the origin, relative to the transform object.</p>
<ul>
<li>Keyword positions: left, right, bottom, top, center</li>
<li>Length values</li>
<li>Percentage values </li>
<li>default is 50% 50% (or center center)</li>
<li>Supported in all browsers that support transform. Prefixed if transform is prefixed</li>
</section>
</div>
<!-- Play Time -->
<div class="slide object">
<header><h1>Play Time</h1>
<object data="files/101_transformorigin.html"></object>
<a href="files/101_transformorigin.html" target="play" class="objectlink">Try it out</a>
</div>
<!-- 3d Transforms -->
<div class="slide normal">
<header style="position:absolute;left: 0; transform: rotate(-90deg) translate(-240px, -100px);"><h1>3d Transforms</h1></header>
<section class="content" style="padding-top:0; margin-top:-20px">
<dl class="deprecated listed wide">
<dt><strong>translate</strong>(<x-length>[, <y-length>])</dt>
<dd>specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter. If <em><ty></em> is not provided, ty has zero as a value.</dd>
<dt><strong class="imp">translate3d</strong>(<x>, <y>, <z>)</dt>
<dd>specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively.</dd>
<dt><strong>translateX</strong>(<x-length>), <strong>translateY</strong>(<y-length>) </dt>
<dd>specifies a translation by the given amount in the X or Y direction.</dd>
<dt><strong class="imp">translateZ</strong>(<z-value>)</dt>
<dd>specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0.</dd>
<dt><strong>scale</strong>(<number>[, <number>])</dt>
<dd>specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first.</dd>
<dt><strong class="imp">scale3d</strong>(<number>, <number>, <number>)</dt>
<dd>specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters.</dd>
<dt><strong>scaleX</strong>(<number>), <strong>scaleY</strong>(<number>)</dt>
<dd>specifies a scale operation using the [sx,1,1] or [1,sy,1] scaling vector, where sx or sy is given as the parameter respectively.</dd>
<dt><strong class="imp">scaleZ</strong>(<number>)</dt>
<dd>specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter.</dd>
<dt><strong>rotate</strong>(<angle>)</dt>
<dd>specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the <em>transform-origin</em> property.</dd>
<dt><strong class="imp">rotate3d</strong>(<number>, <number>, <number>, <angle>)</dt>
<dd>specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters. If the direction vector is not of unit length, it will be normalized. A direction vector that cannot be normalized, such as [0, 0, 0], will cause the rotation to not be applied. This function is equivalent to matrix3d(1 + (1-cos(angle))*(x*x-1), -z*sin(angle)+(1-cos(angle))*x*y, y*sin(angle)+(1-cos(angle))*x*z, 0, z*sin(angle)+(1-cos(angle))*x*y, 1 + (1-cos(angle))*(y*y-1), -x*sin(angle)+(1-cos(angle))*y*z, 0, -y*sin(angle)+(1-cos(angle))*x*z, x*sin(angle)+(1-cos(angle))*y*z, 1 + (1-cos(angle))*(z*z-1), 0, 0, 0, 0, 1).</dd>
<dt><strong>rotateX</strong>(<angle>)</dt>
<dd>specifies a clockwise rotation by the given angle about the X axis.</dd>
<dt><strong>rotateY</strong>(<angle>)</dt>
<dd>specifies a clockwise rotation by the given angle about the Y axis.</dd>
<dt><strong class="imp">rotateZ</strong>(<angle>)</dt>
<dd>specifies a clockwise rotation by the given angle about the Z axis.</dd>
<dt><strong>skewX</strong>(<angle>),<strong>skewY</strong>(<angle>) </dt>
<dd>specifies a skew transformation along the X axis or Y axis by the given angle.</dd>
<dt></dt>
<dt><strong>skew</strong>(<angle> [, <angle>])</dt>
<dd>specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie. no skew on the Y axis).</dd>
<dt><strong>matrix</strong>(<number>{6})</dt>
<dd>specifies a 2D transformation in the form of a transformation matrix of six comma separated values. matrix(a,b,c,d,e,f) is equivalent to matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, e, f, 0, 1).</dd>
<dt><strong class="imp">matrix3d</strong>(<number>{15})</dt>
<dd>specifies a 3D transformation as a 4x4 homogeneous matrix of 16 comma separated values in column-major order.</dd>
<dt><strong class="imp">perspective</strong>(<number>)</dt>
<dd>specifies a perspective projection matrix. This matrix maps a <em>viewing cube</em> onto a pyramid whose base is infinitely far away from the viewer and whose peak represents the viewer's position. The viewable area is the region bounded by the four edges of the viewport (the portion of the browser window used for rendering the webpage between the viewer's position and a point at a distance of infinity from the viewer). The <em>depth</em>, given as the parameter to the function, represents the distance of the z=0 plane from the viewer. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect. The value is given in pixels, so a value of 1000 gives a moderate amount of foreshortening and a value of 200 gives an extreme amount. The matrix is computed by starting with an identity matrix and replacing the value at row 3, column 4 with the value -1/depth. The value for depth must be greater than zero, otherwise the function is invalid.</dd>
</dl>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: perspective</h1></header>
<b class="plane plane_07" data-style="transform">✈</b>
<section class="content">
<pre>transform: <span contenteditable onmouseout="setTempStyle('plane_07', this.innerText)">translate3d(0px, 0px, 0px) perspective(0)</span>;</pre>
<p>Only relevant to 3D transformations</p>
</section>
</div>
<div class="slide normal">
<header><h1>perspective-origin property</h1></header>
<b class="plane plane_07" data-style="perspective-origin">✈</b>
<section class="content">
<pre contenteditable>perspective-origin: <span contenteditable onmouseout="setTempStyle('plane_07b', this.innerText)">left</span>;</pre>
<p>Sets a horizon point at the given coordinates on the parent element. Changes the perceived vantage point at which the user appears to be looking at child elements.</p>
<ul>
<li>Keyword positions: left, right, bottom, top, center</li>
<li>Length values</li>
<li>Percentage values (default = 50% 50%)</li>
</ul>
</section>
</div>
<div class="slide normal">
<header><h1>Other Transform related Properties</h1></header>
<section class="content">
<dl>
<dt>transform-origin: length | keyterm {1,3}</dt>
<dd>The centerpoint of the transform
<dt>transform-style: flat | preserve-3s</dt>
<dd>How to handle nested elements are rendered in 3D space.</dd>
<dt>perspective: none | length</dt>
<dd>Same as <code>transforms: perspective(value)</code> except it applies to the positioned or transformed children of the element, not the element itself.</dd>
<dt>perspective-origin: pos relative to parent</dt>
<dd>Defines the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.
<dt>backface-visibility: visible | hidden</dt>
<dd>When an element is flipped, is the content that is flipped away from user visible or not.</dd>
</dl>
</section>
</div>
<!-- Play Time -->
<div class="slide object">
<header><h1>Play Time</h1>
<object data="files/101_transform3dhtml.html"></object>
<a href="files/101_transform3dhtml.html" target="play" class="objectlink">Try it out</a>
</div>
<div class="slide normal" id="BackfaceVisibility"><div>
<header>
<h1><code>backface-visibility</code></h1>
</header>
<section style="height: 600px;">
<p><code>hidden</code> or <code>visible</code></p>
<div class="backfacedemo">
<div class="uncube" id="backfacecube">
<figure class="front">1</figure>
<figure class="back">2</figure>
<figure class="right">3</figure>
<figure class="left">4</figure>
<figure class="top">5</figure>
<figure class="bottom">6</figure>
</div>
</div>
<button type="button" id="backfacetrigger"
onclick="toggleSides();">Toggle backfaces</button>
<footer>borrowed from <a href="http://www.twitter.com/webinista">@webinista</a></footer>
</section>
</div></div>
<script>
function toggleSides() {
var cube = document.getElementById('backfacecube');
cube.classList.toggle('uncube');
cube.classList.toggle('cube');
// var sides = cube.getElementsByTagName('figure');
// console.log('boo' + sides.length);
// for (var i = 0; i < sides.length; i++) {
// sides[i].classList.toggle('.bf');
// }
}
</script>
<!-- NEXT -->
<div class="slide intro">
<header><h1>Part 11: Transitions & Animation</h1></header>
<h1><a href="part_11_animations.html">Next ➹</a></h1>
</div>
</div>
</div>
<script src="css/slide.js"></script>
<script>
document.addEventListener('keydown',
function(e) { if(e.keyCode == 39){
var nextSlide = document.getElementsByClassName('future')[0];
var temporaryStyleSheet = document.getElementById('tempstyle');
var styles = nextSlide.getElementsByClassName('plane')[0].classList.split('');
console.dir(styles);
} }, false);
</script>
</body>
</html>