-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathindex.html
1001 lines (806 loc) · 34.6 KB
/
index.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
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Transforms || CSS Deep Dive</title>
<link rel="stylesheet" href="screen.css"/>
<link rel="stylesheet" href="transforms.css"/>
<style id="tempstyle"></style>
</head>
<body>
<header>
<nav>
<ul>
<li class="button cancel" id="back">Back</li>
<li class="button done" id="next">Next</li>
</ul>
</nav>
</header>
<div id="presentation">
<div id="presentation-counter"></div>
<div id="slides">
<!-- Title Slide -->
<div class="slide intro">
<header><h1>Transforms</h1></header>
</div>
<!-- Title Slide -->
<div class="slide normal">
<header><h1>Transforming Elements</h1></header>
<section class="content"><b class="letters letters_01">RSVP</b>
<pre>.letters {
transform:
translate(-90px, 300px) rotate(50deg) scale(.7, .9) skew(15deg);
}</pre>
<pre>selector {
transform: none | <transFunc()> [<transFunc()>];
}</pre>
</section>
</div>
<div class="slide figure">
<figure><object data="https://caniuse.com/#search=transforms"></object></figure>
<a href="http://caniuse.com/#search=transforms" target="play" title="open resource in new window">➹</a>
</div>
<!-- DIVIDER -->
<div class="slide divider">
<header><h1>2D Transform Functions</h1></header>
<section class="content">
</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="letters letters_02">RSVP</b>
<section class="content">
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_02', this.innerHTML)">translate(100px, 100px)</span>;</pre>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_02', this.innerHTML)">translateX(100px)</span>;</pre>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_02', this.innerHTML)">translateY(100px)</span>;</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Rotate</h1></header>
<section class="content"> <b class="letters letters_03">RSVP</b>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_03', this.innerHTML)">rotate(90deg)</span>;</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Scale</h1></header>
<section class="content"><b class="letters letters_04">RSVP</b>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_04', this.innerHTML)">scale(0.25, 0.75)</span>;</pre>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_04', this.innerHTML)">scale(0.75)</span>;</pre> <pre>transform: <span contenteditable onmouseout="setTempStyle('letters_04', this.innerHTML)">scaleX(0.25)</span>;</pre>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_04', this.innerHTML)">scaleY(0.75)</span>;</pre>
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: Skew</h1></header>
<section class="content">
<b class="letters letters_05">RSVP</b>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_05', this.innerHTML)">skewX(5deg)</span>;</pre>
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_05', this.innerHTML)">skewY(5deg)</span>;</pre> <pre>transform: <span contenteditable onmouseout="setTempStyle('letters_05', this.innerHTML)">skewX(5deg) skewY(5deg)</span>;</pre> <pre>transform: <span contenteditable onmouseout="setTempStyle('letters_05', this.innerHTML)">skew(5deg,5deg)</span>;</pre>
</section>
</div>
<div class="slide" id="gencontentlink">
<header><h1>Multiple Tranforms</h1></header>
<section class="content transform"><b class="letters letters_06">RSVP</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>
var temporaryStyleSheet = document.getElementById('tempstyle');
function setTempStyle(thisclass, change){
var temporaryStyleSheet = document.getElementById('tempstyle');
temporaryStyleSheet.innerHTML = '.slide .' + thisclass + '::after {transform: '+ change +';}';
console.dir(temporaryStyleSheet);
}
var transformSpans = document.getElementById('ABTrasform').getElementsByTagName('span');
</script>
<div class="slide">
<header><h1>transforms</h1></header>
<section class="content">
<li>Take advantage of <code>transform-origin</code></li>
<li>Multiple values are SPACE separated (no commas)</li>
<li>The order of the values matters</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>
<!-- DIVIDER -->
<div class="slide divider">
<header><h1>function order</h1></header>
<section class="content">
</section>
</div>
<div class="slide">
<header><h1>Transform Order</h1></header>
<section class="content">
<p>Order of transform functions matters: if you rotate first, your translate direction will be on the rotated axis!</p>
<div id="transformorder"><b class="line1"></b><b class="line2"></b></div>
<code style="position: absolute; bottom: 20px">translateX(200px)<br>rotate(135deg)</code>
</section>
</div>
<div class="slide figure">
<header><h1>Funtion Order</h1></header>
<figure><object data="files/transforms/tOrder.html"></object></figure>
<a href="files/transforms/tOrder.html" target="play" title="open resource in reused window">➹</a>
</div>
<!-- DIVIDER -->
<div class="slide divider">
<header><h1>3D Transform Functions</h1></header>
<section class="content">
</section>
</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 letters 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 figure">
<figure><object data="https://caniuse.com/#search=3d%20transforms"></object></figure>
<a href="http://caniuse.com/#search=3d%20transforms" target="play" title="open resource in new window">➹</a>
</div>
<!-- DIVIDER -->
<div class="slide divider">
<header><h1>3D Transform Related Properties</h1></header>
<section class="content">
</section>
</div>
<div class="slide normal">
<header><h1>3D Transform related Properties</h1></header>
<section class="content">
<dl class="deprecated listed wide">
<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>transform-origin: length | keyterm {1,3}</dt>
<dd>The centerpoint of the transform
<dt>transform-style: flat | preserve-3d</dt>
<dd>How to handle nested elements are rendered in 3D space.</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>
<!-- Perspective -->
<div class="slide divider">
<header><h1>Perspective</h1></header>
<section class="content">
</section>
</div>
<!-- 3D -->
<div class="slide">
<header><h1>Perspective</h1></header>
<section class="content">
Screens are flat. 3D requires perspective.
<ol>
<li><code>transform: perspective(100) ...</code></li>
<li><code>perspective: 100</code>
</li>
</ol>
<p>Difference: with the parent property, all the transformed elements share the same perspective. with the function, each transformed element has it's own perspective.
</section>
</div>
<div class="slide normal">
<header><h1>Transform Function: <code>perspective()</code></h1></header>
<b class="letters letters_07">RSVP</b>
<section class="content">
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_07', this.innerHTML)"> perspective(40px) rotateX(10deg)</span>;</pre>
<p>The <code>perspective()</code> function must come first</p>
<p>Smaller numbers have a bigger impact</p>
</section>
</div>
<div class="slide object">
<header><h1><code>perspective</code> Property</h1></header>
<object data="files/transforms/perspective.html"></object>
<a href="files/transforms/perspective.html" target="play" title="open resource in reused window">➹</a>
</section>
</div>
<!-- -->
<div class="slide">
<style>
.perspective article {display: flex; justify-content: center;}
.perspective article div {
width: 150px; height: 150px; display: inline-block; line-height: 150px; font-size: 50px; background-color:palegoldenrod; margin: 10px;
color: #A9403A;
border: 1px dashed;
text-align: center;
transform: perspective(400px) rotatex(25deg);
}
.perspective article:last-of-type div {
transform: rotatex(25deg);
}
.perspective article:last-of-type {
perspective: 400px;
}
.pOrigin article {
perspective-origin: 0 0;
}
</style>
<header><h1><code>transform: perspective(400px)</code> v. <code>perspective: 400px</code></h1></header>
<section class="content perspective">
<p><code>transform: perspective(400px)</code> on children</p>
<article><div>1</div><div>2</div><div>3</div></article>
<p><code>perspective: 400px</code> on parent</p>
<article><div>1</div><div>2</div><div>3</div></article>
</section>
</div>
<!-- Perspective -->
<div class="slide divider">
<header><h1>perspective-origin</h1></header>
<section class="content">
</section>
</div>
<!-- -->
<div class="slide">
<header><h1>perspective-origin</h1></header>
<section class="content"><p><code>perspective-origin: x y</code></p>
<ul>
<li>Property on parent element</li>
<li>Positions the perspective relative to parent, defining the origin for the <code>perspective</code> property. </li>
<li>Sets the X and Y position at which the viewer appears to be looking at the children of the element.
</section>
</div>
<div class="slide object">
<header><h1>perspective-origin Property</h1></header>
<object data="files/transforms/pOrigin.html"></object>
<a href="files/transforms/pOrigin.html" target="play" class="objectlink">➹</a>
</div>
<div class="slide perspective pOrigin">
<header><h1><code>perspective-origin</code> with <code>perspective: 400px</code></h1></header>
<section class="content perspective">
<p><code>perspective-origin: 0 0</code> on parent</p>
<article><div>1</div><div>2</div><div>3</div></article>
<article><div>1</div><div>2</div><div>3</div></article>
<p>only works if <code>perspective</code> is on that parent!</p>
</section>
</div>
<!-- divider -->
<div class="slide divider">
<header><h1>transform-origin</h1></header>
<section class="content">
</section>
</div>
<div class="slide">
<header><h1>transform-origin property</h1></header>
<section class="content">
<b class="letters letters_07b">RSVP</b>
<section class="content">
<pre>transform:<span contenteditable onmouseout="setTempStyle('letters_07b', this.innerHTML, 'transform')"> perspective(40px) rotateX(10deg);
transform-origin: top left;</span></pre>
<p style="font-size: 2rem">Specifies the x and y position of the origin, relative to the transform object.</p>
</section>
</div>
<div class="slide">
<header><h1>transform-origin property</h1></header>
<b class="letters letters_07c">RSVP</b>
<section class="content">
<pre>transform: <span contenteditable onmouseout="setTempStyle('letters_07c', this.innerHTML)">rotate(90deg);
transform-origin: top left</span>;</pre>
<ul style="font-size: 1.7rem">
<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>
<!-- divider -->
<div class="slide divider">
<header><h1>transform-style</h1></header>
<section class="content">
</section>
</div>
<!-- -->
<div class="slide">
<header><h1>transform-style</h1></header>
<section class="content">
<dl>
<dt>transform-style: flat | preserve-3d</dt>
<dd>How to handle nested elements are rendered in 3D space.</dd>
</dl>
<ul>
<li>Default is flat</li>
<li>Set on parent element</li>
<li>Only works if the following are set to their default values:
<ul><li>overflow</li>
<li>clip</li>
<li>clip-path</li>
<li>filter</li>
<li>mask-border-source</li>
<li>mask-image</li>
<li>mix-blend-mode</li>
</ul>
</li>
</ul>
</section>
</div>
<div class="slide object">
<header><h1><code>transform-style</code> Property</h1></header>
<object data="files/transforms/tStyle1.html"></object>
<a href="files/transforms/tStyle1.html" target="play" title="open resource in reused window">➹</a>
</section>
</div>
<div class="slide object">
<header><h1>transform-style Property</h1></header>
<object data="files/transforms/tStyle.html"></object>
<a href="files/transforms/tStyle.html" target="play" class="objectlink">➹</a>
</div>
<!-- divider -->
<div class="slide divider">
<header><h1>backface-visibility</h1></header>
<section class="content">
</section>
</div>
<div class="slide object">
<header><h1>backface-visibility Property</h1></header>
<object data="files/transforms/backfacevisibility.html"></object>
<a href="files/transforms/backfacevisibility.html" target="play" class="objectlink">➹</a>
</div>
<!-- transform box -->
<div class="slide">
<header><h1>transform-box property</h1></header>
<section class="content">
<p>Future: Defines the layout box, to which the <code>transform</code> and <code>transform-origin</code> properties relate to. <small>(FF, Ch 64, O 51)</small></p>
<dl>
<dt><code>border-box</code></dt>
<dd>border box as reference box.</dd>
<dt><code>fill-box</code></dt>
<dd>Uses the object bounding box as reference box.</dd>
<dt><code>view-box</code></dt>
<dd>Nearest SVG viewport as reference box. If <code>viewBox</code> attribute exists, the reference box is at the <code>viewBox</code> 0 0, and the width and height are those of the <code>viewBox</code> attribute.</dd>
</dl>
</section>
</div>
<!-- NEXT -->
<div class="slide divider">
<header><h1>Transitions & Animation</h1></header>
<h1><a href="../animations/">Next ➹</a></h1>
</div>
<div class="slide dots">
<header><h1>Table of Content</h1></header>
<section>
<ol class="column2">
<li><a href="../intro">Introduction</a></li>
<li><a href="../selectors">Selectors</a></li>
<li><a href="../selectors">Specificity</a></li>
<li><a href="../generated">Generated Content</a></li>
<li><a href="../media">Media Queries</a></li>
<li><a href="../sass">Best Practices</a></li>
<li><a href="../debugging">Debugging</a></li>
<li><a href="../colors">Colors & Transparency </a></li>
<li><a href="../flexbox">Flexbox</a></li>
<li><a href="../tables">Tables</a></li>
<li><a href="../grid">Grids</a></li>
<li><a href="../borders">Backgrounds & Borders </a></li>
<li><a href="../gradients">Gradients</a></li>
<li><a href="../transforms">Transforms</a></li>
<li><a href="../animations">Transitions & Animation</a></li>
<li><a href="../other">Other Features</a></li>
</ol>
</section>
</div>
<!-- TOC -->
<div class="slide">
<header><h1>Links</h1></header>
<section class="content">
<ul>
</ul>
</section>
</div>
</div>
</div>
<script>
(function() {
var doc = document,
disableBuilds = true,
ctr = 0,
spaces = /\s+/,
a1 = [''],
toArray = function(list) {
return Array.prototype.slice.call(list || [], 0);
},
byId = function(id) {
if (typeof id == 'string') { return doc.getElementById(id); }
return id;
},
query = function(query, root) {
if (!query) { return []; }
if (typeof query != 'string') { return toArray(query); }
if (typeof root == 'string') {
root = byId(root);
if(!root){ return []; }
}
root = root || document;
var rootIsDoc = (root.nodeType == 9);
var doc = rootIsDoc ? root : (root.ownerDocument || document);
// rewrite the query to be ID rooted
if (!rootIsDoc || ('>~+'.indexOf(query.charAt(0)) >= 0)) {
root.id = root.id || ('qUnique' + (ctr++));
query = '#' + root.id + ' ' + query;
}
// don't choke on something like ".yada.yada >"
if ('>~+'.indexOf(query.slice(-1)) >= 0) { query += ' *'; }
return toArray(doc.querySelectorAll(query));
},
strToArray = function(s) {
if (typeof s == 'string' || s instanceof String) {
if (s.indexOf(' ') < 0) {
a1[0] = s;
return a1;
}
else {
return s.split(spaces);
}
}
return s;
},
addClass = function(node, classStr) {
classStr = strToArray(classStr);
var cls = ' ' + node.className + ' ';
for (var i = 0, len = classStr.length, c; i < len; ++i) {
c = classStr[i];
if (c && cls.indexOf(' ' + c + ' ') < 0) {
cls += c + ' ';
}
}
node.className = cls.trim();
},
removeClass = function(node, classStr) {
var cls;
if (classStr !== undefined) {
classStr = strToArray(classStr);
cls = ' ' + node.className + ' ';
for (var i = 0, len = classStr.length; i < len; ++i) {
cls = cls.replace(' ' + classStr[i] + ' ', ' ');
}
cls = cls.trim();
} else {
cls = '';
}
if (node.className != cls) {
node.className = cls;
}
},
toggleClass = function(node, classStr) {
var cls = ' ' + node.className + ' ';
if (cls.indexOf(' ' + classStr.trim() + ' ') >= 0) {
removeClass(node, classStr);
} else {
addClass(node, classStr);
}
},
ua = navigator.userAgent,
isFF = parseFloat(ua.split('Firefox/')[1]) || undefined,
isWK = parseFloat(ua.split('WebKit/')[1]) || undefined,
isOpera = parseFloat(ua.split('Opera/')[1]) || undefined,
canTransition = (function() {
var ver = parseFloat(ua.split('Version/')[1]) || undefined;
// test to determine if this browser can handle CSS transitions.
var cachedCanTransition =
(isWK || (isFF && isFF > 3.6 ) || (isOpera && ver >= 10.5));
return function() { return cachedCanTransition; }
}
)();
//-----------------------------------------------------------------//
var Slide = function(node, idx) {
this._node = node;
if (idx >= 0) {
this._count = idx + 1;
}
if (this._node) {
addClass(this._node, 'slide distant-slide');
}
this._makeCounter();
this._makeBuildList();
};
Slide.prototype = {
_node: null,
_count: 0,
_buildList: [],
_visited: false,
_currentState: '',
_states: [ 'distant-slide', 'far-past',
'past', 'current', 'future',
'far-future', 'distant-slide' ],
setState: function(state) {
if (typeof state != 'string') {
state = this._states[state];
}
if (state == 'current' && !this._visited) {
this._visited = true;
this._makeBuildList();
}
removeClass(this._node, this._states);
addClass(this._node, state);
this._currentState = state;
var _t = this;
setTimeout(function(){ _t._runAutos(); } , 400);
},
_makeCounter: function() {
if(!this._count || !this._node) { return; }
var c = doc.createElement('span');
c.innerHTML = this._count;
c.className = 'counter';
this._node.appendChild(c);
},
_makeBuildList: function() {
this._buildList = [];
if (disableBuilds) { return; }
if (this._node) {
this._buildList = query('[data-build] > *', this._node);
}
this._buildList.forEach(function(el) {
addClass(el, 'to-build');
});
},
_runAutos: function() {
if (this._currentState != 'current') {
return;
}
// find the next auto, slice it out of the list, and run it
var idx = -1;
this._buildList.some(function(n, i) {
if (n.hasAttribute('data-auto')) {
idx = i;
return true;
}
return false;
});
if (idx >= 0) {
var elem = this._buildList.splice(idx, 1)[0];
var transitionEnd = isWK ? 'webkitTransitionEnd' : (isFF ? 'mozTransitionEnd' : 'oTransitionEnd');
var _t = this;
if (canTransition()) {
var l = function(evt) {
elem.parentNode.removeEventListener(transitionEnd, l, false);
_t._runAutos();
};
elem.parentNode.addEventListener(transitionEnd, l, false);
removeClass(elem, 'to-build');
} else {
setTimeout(function() {
removeClass(elem, 'to-build');
_t._runAutos();
}, 400);
}
}
},
buildNext: function() {
if (!this._buildList.length) {
return false;
}
removeClass(this._buildList.shift(), 'to-build');
return true;
},
};
//
// SlideShow class
//
var SlideShow = function(slides) {
this._slides = (slides || []).map(function(el, idx) {
return new Slide(el, idx);
});
var h = window.location.hash;
try {
this.current = parseInt(h.split('#slide')[1], 10);
} catch (e) { /* squeltch */ }
this.current = isNaN(this.current) ? 1 : this.current;
var _t = this;
doc.addEventListener('keydown', function(e) { _t.handleKeys(e); }, false);
doc.addEventListener('mousewheel', function(e) { _t.handleWheel(e); }, false);
doc.addEventListener('DOMMouseScroll', function(e) { _t.handleWheel(e); }, false);
doc.addEventListener('touchstart', function(e) { _t.handleTouchStart(e); }, false);
doc.addEventListener('touchend', function(e) { _t.handleTouchEnd(e); }, false);
window.addEventListener('popstate', function(e) { _t.go(e.state); }, false);
doc.getElementById('back').addEventListener('click', function(e) {_t.prev();}, false);
doc.getElementById('next').addEventListener('click', function(e) {_t.next();}, false);
this._update();
};
SlideShow.prototype = {
_slides: [],
_update: function(dontPush) {
document.querySelector('#presentation-counter').innerText = this.current;
if (history.pushState) {
if (!dontPush) {
history.pushState(this.current, 'Slide ' + this.current, '#slide' + this.current);
}
} else {
window.location.hash = 'flopslide' + this.current;
}
for (var x = this.current-1; x < this.current + 7; x++) {
if (this._slides[x-4]) {
this._slides[x-4].setState(Math.max(0, x-this.current));
}
}
},
current: 0,
next: function() {
if (!this._slides[this.current-1].buildNext()) {
this.current = Math.min(this.current + 1, this._slides.length);
this._update();
}
},
prev: function() {
this.current = Math.max(this.current-1, 1);
this._update();
},
go: function(num) {
if (!num) return;
if (history.pushState && this.current != num) {
history.replaceState(this.current, 'Slide ' + this.current, '#slide' + this.current);
}
this.current = num;
this._update(true);
},
_notesOn: false,
showNotes: function() {
var isOn = this._notesOn = !this._notesOn;
query('.notes').forEach(function(el) {
el.style.display = (isOn) ? '' : 'none';
});
},
handleWheel: function(e) {
var delta = 0;
if (e.wheelDelta) {
delta = e.wheelDelta/120;
if (isOpera) {
delta = -delta;
}
}
else if (e.detail) {
delta = -e.detail/3;
}
if (delta > 0 ) {
this.prev();
return;
}
if (delta < 0 ) {
this.next();
return;
}
},
addNotes: function(){
if(document.querySelector('.current textarea.mynotes')) {
document.querySelector('.current textarea.mynotes').classList.toggle('temphidden');
return;
}
var ta = document.createElement('textarea'),
currentSlide = document.querySelector('.current section'),
path = window.location.pathname,
A = path.lastIndexOf('/') + 1,
B = path.lastIndexOf('.'),
firstPartOfKey, key;
if(B && B > A){
firstPartOfKey = path.substring(A, B);
} else {
firstPartOfKey = path.substring(1, path.length-1) || 'home';
}
//console.log(firstPartOfKey);
key = firstPartOfKey + window.location.hash;
ta.value = window.localStorage.getItem(key) || '';
ta.className = 'mynotes';
ta.addEventListener('keyup', function(){
//console.log(key + ' ' + ta.value)
window.localStorage.setItem(key,ta.value);
});
currentSlide.appendChild(ta);
},
removeHidingClass: function(){
var paragraphToShow = document.querySelector('.current .temphidden');
if(paragraphToShow) {paragraphToShow.classList.remove('temphidden');}
},
handleKeys: function(e) {
// disable keys for these elements
if (/^(input|textarea|pre|object)$/i.test(e.target.nodeName)) return;
switch (e.keyCode) {
case 37: // left arrow
case 33: // left clicker
this.prev(); break;
case 39: // right arrow
case 32: // space
case 34: // clicker right
this.next(); break;
case 50: // 2
case 190: // 2
this.showNotes();
this.removeHidingClass();
break;
case 52: // 4 (for taking notes with local storage (students)
this.addNotes(); break;
break;
}
},
_touchStartX: 0,
handleTouchStart: function(e) {
this._touchStartX = e.touches[0].pageX;
},
handleTouchEnd: function(e) {
var delta = this._touchStartX - e.changedTouches[0].pageX;
var SWIPE_SIZE = 150;
if (delta > SWIPE_SIZE) {
this.next();
} else if (delta< -SWIPE_SIZE) {
this.prev();
}
},
};
// Initialize
var slideshow = new SlideShow(query('.slide'));
})();
</script>
</body>