-
Notifications
You must be signed in to change notification settings - Fork 83
/
part_11_animations.html
1038 lines (831 loc) · 27.6 KB
/
part_11_animations.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>
<!--[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>Gradients || CSS: From Knowledgable to Ninja</title>
<!--<script>
document.location.href = '../animation/index.html'
</script>-->
<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>
.h1 {font-size: 80px;}
.hoverme {color: #C7573A; text-decoration:underline;}
.hoverme:hover {color: #BDD9D5;}
.simptrans {transition:1s;}
/*.simptrans:hover {transition:10s}*/
.code {
color: #000000;
font-size: 85%;
background-color: rgba(255,255,255,0.4);
transition: all 0.5s ease-in 50ms;
}
.code:hover {
color: #C7573A;
font-size: 105%;
background-color: rgba(255,255,255,0.8);
}
.yes, .no {
position: relative;
}
.yes:after, .no:after {
content: '✓';
color:green;
font-size:60px;
position:absolute;
top: 5px;
right: 5px;
}
.no:after {
content: 'X';
color: red;
font-family: "Comic Sans MS", cursive;
}
.spinbox, .plane {
position:relative;
font-size: 100px;
color:#C7573A;
display:block;
height: 140px;
width: 140px;margin:10px auto;
text-align:center;
font-size: 140px;
}
.plane, .plane2 {
display: block;
line-height: 140px;
position: absolute;
top: 0; left: 0;
transition: all 1s ease-in 50ms;
transform-origin: 100px 150px;
}
.spinbox .dot {
position: absolute;
top: 150px;
left: 100px;
height:5px; width: 5px;
border-radius: 0.5em}
.spinbox:hover .dot {
background-color:#C7573A;
}
.spin:hover {
transform: rotate(360deg) scale(2);
}
.plane_01 {animation: flying 3s infinite 1s; animation-play-state:paused;}
.plane_03 {animation: flyingDangerously 3s infinite; animation-play-state:paused;}
.plane_04 {animation: UFO 3s infinite; animation-play-state:paused;}
.plane_05 {animation: flyingTowardsUser 3s infinite; animation-play-state:paused;}
.to {transform-origin: left 300px;}
.slide:hover .plane_01,
.slide:hover .plane_03,
.slide:hover .plane_04,
.slide:hover .plane_05,
.slide:hover .plane_06,
.slide:hover .plane_07,
.slide:hover .planeanim_01
{animation-play-state:running;}
.plane_pausing {
left: 350px;
transform-origin: center 300px;
animation: flyingInCircles 3s linear infinite;
}
.plane_pausing:hover {
animation-play-state:paused;
}
@keyframes flyingInCircles {
100% {
transform:
rotate(360deg);
}
}
@keyframes flying {
0% {
left: 0;
}
100% {
left: 100%;
}
}
@keyframes flyingDangerously {
0% {
left: 0;
}
10% {
left: 45%;
}
90% {
left: 55%;
}
100% {
left: 100%;
}
}
@keyframes UFO {
0% {
left: 0;
opacity: 1;
}
50% {
opacity: 0.1;
}
100% {
left: 100%;
opacity: 1
}
}
@keyframes flyingTowardsUser {
0%{
transform:
translate3d(0, 0, 0) rotate(0deg) scale(0.7, 0.7);
}
100% {
transform:
translate3d(600px, 400px, 0) rotate(80deg) scale(1.2, 1.2);
}
}
.slide nav ul,.slide nav ul li {margin: 0; padding: 0;}
.slide nav ul li {list-style-type: none; background-color: #C7573A; color: white; margin:0; padding: 3px 5px; border: 1px solid #fff;}
nav > ul > li {display: inline-block; position:relative;}
nav ul ul {transform: scale(1,0); transform-origin: top center; transition:0.2s linear 50ms; position:absolute; top: 100%;}
nav li:hover ul {transform: scale(1,1);}
.planeanim {
-webkit-transform-origin: left 300px;
-moz-transform-origin: left 300px;
-ms-transform-origin: left 300px;
transform-origin: left 300px;
}
.planeanim_01 {
transform-origin: left 300px;
animation-name: flyingTowardsUser;
animation-duration: 3s;
animation-timing-function: ease-in-out;
animation-iteration-count: 3;
animation-play-state: paused;
}
pre u {text-decoration:none; font-weight:bold;}
</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 11: Transitions & Animations</h1></header>
</div>
<!-- Simplest Transition -->
<div class="slide normal">
<header><h1>Simplest Transition</h1></header>
<section class="content">
<pre style="font-size:140%;">a {
color: #C7573A;
}
a:hover {
color: #BDD9D5;
}</pre>
<p class="hoverme h1">Hover Over Me</p>
</section>
</div>
<!-- CSS3 Transition -->
<div class="slide normal">
<header><h1>CSS3 Transition</h1></header>
<section class="content">
<pre style="font-size:140%;">a {
color: #C7573A;
transition: 1s;
}
a:hover {
color: #BDD9D5;
}</pre>
<p class="hoverme h1 simptrans">Hover Over Me</p>
</section>
</div>
<!-- property overview -->
<div class="slide">
<header><h1>transitions</h1></header>
<section class="content">
<p>Enables the transition of properties from one state to the next over a defined length of time</p>
<ul>
<li><em>transition-property:</em> properties (or 'all') that transition</li>
<li><em>transition-duration:</em> s or ms it takes to transition</li>
<li><em>transition-timing-function:</em> bezier curve of transition</li>
<li><em>transition-delay:</em> s or ms before transition starts</li>
<li><em>transition:</em> shorthand for 4 transition properties</li>
</ul>
<ul class="icons" style="clear: both;">
<li class="chrome">Chrome</li>
<li class="safari">Safari</li>
<li class="firefox">Firefox 4</li>
<li class="opera">Opera 10.5</li>
<li class="ie new">IE 10</li>
<li class="txt"> all with vendor prefix</li>
</ul>
</section>
</div>
<!-- font transition example -->
<div class="slide">
<header><h1>transitions</h1></header>
<section class="content">
<pre contenteditable class="code">code {
color: #000000;
font-size: 100%;
background-color: rgba(255,255,255,0.4);
transition: all 0.5s ease-in 50ms;
}
code:hover {
color: #C7573A;
font-size: 120%;
background-color: rgba(255,255,255,0.8);
}
</pre>
<pre contenteditable>code {
transition:
color, font-size, background-color 0.5s ease-in 50ms;
}</pre>
</section>
</div>
<!-- what can be transitioned? -->
<div class="slide normal">
<header><h1>What can be transitioned?</h1></header>
<section class="content">
<p>Anything that has intermediate values</p>
<pre style="width: 40%; float:left;" class="yes">code {
opacity: 1;
}
code:halfway {
opacity: 0.5;
}
code:hover {
opacity: 0;
}</pre>
<pre style="width: 40%; float:right;" class="no">code {
display: block;
}
code:halfway {
display: ???
}
code:hover {
display: none;
}</pre>
</section>
</div>
<!-- what can be transitioned2? -->
<div class="slide normal">
<header><h1>What can be transitioned?</h1></header>
<section class="content">
<p>2 values that have REAL intermediary values</p>
<pre style="width: 40%; float:left;" class="yes">code {
font-size: 100%;
}
code:halfway {
font-size: 110%;
}
code:hover {
font-size: 120%;
}</pre>
<pre style="width: 40%; float:right;" class="no">code {
height: auto;
}
code:halfway {
height: ???
}
code:hover {
height: 1000px;
}</pre>
</section>
</div>
<!-- transitioning transforms -->
<div class="slide normal">
<header><h1>Transitioning Transforms</h1></header>
<em class="spinbox"><i class="dot"></i><b class="plane2 spin">✈</b></em>
<section class="content">
<pre contenteditable>
.plane {
transition: all 1s ease-in 50ms;
transform-origin: 100px 150px;
}
.plane:hover {
transform: rotate(360deg) scale(2);
}</pre>
</section>
</div>
<!-- Tranform Features (or Limitations) -->
<div class="slide normal">
<header><h1>Tranform Features (or Limitations)</h1></header>
<section class="content">
<ul>
<li>Single Iteration</li>
<li>Reverse is controllable</li>
<li>Reverse goes to initial state</li>
<li>No granular control</li>
<li>Limited methods of initiation</li>
<li>Can't force them to finish</li>
</ul>
</section>
</div>
<!-- Useful example -->
<div class="slide normal">
<header><h1>Putting it together in the Real World</h1></header>
<section class="content" style="min-height: 400px;">
<nav>
<ul>
<li>About
<ul>
<li>Me</li>
<li>You</li>
<li>Them</li>
<li>Nobody</li>
</ul>
</li>
<li>Posts
<ul>
<li>Door Post</li>
<li>Wall hanging</li>
<li>Stair Banister</li>
<li>Washington</li>
</ul></li>
<li>Topics
<ul>
<li>CSS3</li>
<li>JavaScript</li>
<li>HTML5</li>
<li>SEO</li>
</ul></li>
<li>Events
<ul>
<li>Party</li>
<li>Dinner</li>
<li>Hike</li>
<li>Foo Camp</li>
</ul></li>
</ul>
</nav>
<pre contenteditable>nav ul li {
list-style-type: none;
}
nav > ul > li {
display: inline-block;
position:relative;
}
nav ul ul {
transform: scale(1,0);
transform-origin: top center;
transition:0.2s linear 50ms;
position:absolute;
top: 100%;
}
nav li:hover ul {
transform: scale(1,1);
}</pre>
</section>
</div>
<div class="slide intro">
<header><h1>Animations</h1></header>
<section class="content">
</section>
</div>
<div class="slide normal">
<header><h1>Animation Features (or limitations)</h1></header>
<section class="content">
<ul>
<li>Single, many or infinite iterations</li>
<li>Single or bi-directional</li>
<li>Granular control</li>
<li>Can be initiated on page load</li>
<li>Has more robust JS Hooks</li>
<li>Can be paused</li>
<li>Lowest priority in UI Thread</li>
</ul>
</section>
</div>
<div class="slide normal">
<header>
<h1>Animation Essentials</h1>
</header>
<section class="content">
<ul class="imp">
<li>@keyframes</li>
<li>animation-name</li>
<li>animation-duration</li>
<li>animation-timing-function</li>
<li>animation-iteration-count</li>
<li>animation-direction</li>
<li>animation-play-state</li>
<li>animation-delay</li>
<li>animation-fill-mode</li>
<li>animation (shorthand)</li>
</ul>
</section>
</div>
<div class="slide intro">
<header><h1>@Keyframes</h1></header>
<section class="content">
</section>
</div>
<div class="slide">
<header><h1>Keyframes</h1></header>
<section class="content">
<b class="plane plane_01">✈</b>
<pre contenteditable><b>@keyframes</b> <b>flying</b> {
<b>from</b> {
left: 0;
}
<b>to</b> {
left: 100%;
}
}</pre>
</section>
</div>
<div class="slide">
<header><h1>Keyframes</h1></header>
<section class="content">
<b class="plane plane_01">✈</b>
<pre contenteditable>@keyframes flying {
<b>0%</b> {
left: 0;
}
<b>100%</b> {
left: 100%;
}
}</pre>
<p>Don't forget the <b class="imp" style="border-bottom:double 3px;">%</b></p>
<p>Don't quote the animation name</p>
</section>
</div>
<div class="slide">
<header>
<h1>Granular animation control</h1>
</header>
<section class="content">
<b class="plane plane_03">✈</b>
<pre contenteditable>@keyframes flyingDangerously {
<b>0%</b> {
left: 0;
}
<b>10%</b> {
left: 45%;
}
<b>90%</b> {
left: 55%;
}
<b>100%</b> {
left: 100%;
}
}
</pre>
</section>
</div>
<div class="slide">
<header>
<h1>Animating multiple properties</h1>
</header>
<section class="content">
<b class="plane plane_04">✈</b>
<pre contenteditable>@keyframes <b>UFO</b> {
0% {
<b>left:</b> 0;
<b>opacity:</b> 1;
}
50% {
<b>opacity:</b> 0.1;
}
100% {
<b>left:</b> 100%;
<b>opacity:</b> 1
}
}
</pre>
</section>
</div>
<div class="slide" id="acsst">
<header>
<h1>Animating CSS Transforms</h1>
</header>
<section class="content">
<b class="plane plane_05">✈</b>
<pre contenteditable>@<u></u>keyframes flyingTowardsUser {
0%{
<u></u>transform:
<b>translate3d(0, 0, 0) rotate(0deg) scale(0.7, 0.7);</b>
}
100% {
<u></u>transform:
<b>translate3d(600px, 400px, 0) rotate(80deg) scale(1.2, 1.2);</b>
}
}
</pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'acsst')">-webkit-</span><span onClick="vendorPrefix('r', 'acsst')"> | </span> <span onClick="vendorPrefix('m', 'acsst')">-moz-</span> | <span onClick="vendorPrefix('ms', 'acsst')">-ms-</span> </p>
</section>
</div>
<div class="slide" id="trans3da">
<header>
<h1>with ‘transform-origin’</h1>
</header>
<section class="content">
<b class="plane plane_05 to">✈</b>
<pre contenteditable>@<u></u>keyframes flyingTowardsUser {
0%{
<u></u>transform:
<b>translate3d(0, 0, 0) rotate(0deg) scale(0.7, 0.7);</b>
}
100% {
<u></u>transform:
<b>translate3d(600px, 400px, 0) rotate(80deg) scale(1.2, 1.2);</b>
}
}
</pre>
<pre contenteditable><b>.plane {
-webkit-transform-origin: left 300px;
-moz-transform-origin: left 300px;
-ms-transform-origin: left 300px;
}</b></pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'trans3da')">-webkit-</span><span onClick="vendorPrefix('r', 'trans3da')"> | </span> <span onClick="vendorPrefix('m', 'trans3da')">-moz-</span> | </span> <span onClick="vendorPrefix('ms', 'trans3da')">-ms-</span> </p>
</section>
</div>
<div class="slide intro">
<header><h1>But nothing is animated yet!</h1></header>
<section class="content">
</section>
</div>
<div class="slide normal">
<header><h1>Base CSS</h1></header>
<section class="content">
<pre contenteditable><b>.plane {
-webkit-transform-origin: left 300px;
-moz-transform-origin: left 300px;
-ms-transform-origin: left 300px;
}</b></pre>
</section>
</div>
<div class="slide" id="animdur">
<b id="animationduration" class="plane planeanim">✈</b>
<header>
<h1>animation name and duration</h1>
</header>
<section class="content">
<pre contenteditable>.plane { <input type="range" value="3" min="1" max="15" step="1" id="speedrange" onChange="changeDuration();"/>
...
<u></u>transform-origin: left 300px;
...
<b><u></u>animation-name: flyingTowardsUser;
<u></u>animation-duration: <span class="changer">3</span>s;</b>
</pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'animdur')">-webkit-</span><span onClick="vendorPrefix('r', 'animdur')"> | </span> <span onClick="vendorPrefix('m', 'animdur')">-moz-</span> | </span> <span onClick="vendorPrefix('ms', 'animdur')">-ms-</span> </p>
</section>
<script defer>
function changeDuration(){
var speed = document.getElementById('speedrange').value;
document.getElementById('animationduration').style.webkitAnimationDuration = speed + 's';
document.getElementById('animationduration').style.webkitAnimationName = 'flyingTowardsUser';
var seconds = document.querySelectorAll("#animdur span.changer");
for(var i = 0, j = seconds.length; i < j; i++){
seconds[i].innerHTML = speed;
}
}
</script>
</div>
<div class="slide" id="animtf">
<b id="animationtimingfunc" class="plane planeanim">✈</b>
<header>
<h1>‘animation-timing-function’</h1>
</header>
<section class="content">
<pre contenteditable>.plane { <select onChange="changeTimingFunction(event)"><option value="ease">ease</option><option value="ease-in">ease-in</option><option value="ease-out">ease-out</option><option value="ease-in-out" selected>ease-in-out</option><option value="step-start">step-start</option><option value="step-end">step-end</option><option value="steps(8, start)">steps(8, start)</option></select>
...
<u></u>animation-name: flyingTowardsUser;
<u></u>animation-duration: 8s;
<b><u></u>animation-timing-function: <span class="changer">ease-in-out</span>;</b>
}</pre>
<pre contenteditable><strong>ease</strong>
linear
ease-in
ease-out
ease-in-out
step-start <span class="notes">/* same as steps(1, start) */</span>
step-end <span class="notes">/* same as steps(1, end) */</span>
steps( X, start|<strong>end</strong>) <span class="notes">/* X = # of steps + when change of value occurs */</span>
cubic-bezier(x1, y1, x2, y2)</pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'animtf')">-webkit-</span><span onClick="vendorPrefix('r', 'animtf')"> | </span> <span onClick="vendorPrefix('m', 'animtf')">-moz-</span> <span onClick="vendorPrefix('r', 'animtf')"> | </span> <span onClick="vendorPrefix('ms', 'animtf')">-ms-</span> </p>
</section>
<script defer>
function changeTimingFunction(event){
var speed = event.target.value;
console.log(speed)
var seconds = document.querySelectorAll("#animtf span.changer");
for(var i = 0, j = seconds.length; i < j; i++){
seconds[i].innerHTML = speed;
}
document.getElementById('animationtimingfunc').style.webkitAnimationDuration = '8s';
document.getElementById('animationtimingfunc').style.webkitAnimationName = 'flyingTowardsUser';
document.getElementById('animationtimingfunc').style.webkitAnimationTimingFunction = speed;
}
</script>
</div>
<div class="slide" id="animic">
<header>
<h1>‘animation-iteration-count’</h1>
</header>
<section class="content">
<b class="plane planeanim planeanim_01">✈</b>
<pre contenteditable>
.plane {
...
<u></u>animation-name: flying;
<u></u>animation-duration: 3s;
<u></u>animation-timing-function: ease-in-out;
<b><u></u>animation-iteration-count: 3;</b>
}</pre>
<p>‘infinte’ or number. Default is ‘1’.</p>
<pre contenteditable><b>-webkit-animation-iteration-count: 3;</b>
<b>-moz-animation-iteration-count: 3;</b>
<b>-ms-animation-iteration-count: 3;</b></pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'animic')">-webkit-</span><span onClick="vendorPrefix('r', 'animic')"> | </span> <span onClick="vendorPrefix('m', 'animic')">-moz-</span><span onClick="vendorPrefix('r', 'animic')"> | </span> <span onClick="vendorPrefix('ms', 'animic')">-ms-</span> </p>
</section>
</div>
<div class="slide" id="animdelay"> <b id="animationdelayi" class="plane planeanim">✈</b>
<header>
<h1>‘animation-delay’</h1>
</header>
<section class="content">
<pre contenteditable>.plane { <input type="range" value="2" min="-5" max="10" step="0.5" id="delayrange" onchange="changeTime()" /><button onClick="changeDelay();">Start</button>
...
<u></u>animation-name: flyingTowardsUser;
<u></u>animation-duration: 8s;
<u></u>animation-timing-function: ease-in-out;
<u></u>animation-iteration-count: 2;
<b><u></u>animation-delay: <span class="changer">2</span>s;</b>
}</pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'animdelay')">-webkit-</span><span onClick="vendorPrefix('r', 'animdelay')"> | </span> <span onClick="vendorPrefix('m', 'animdelay')">-moz-</span> <span onClick="vendorPrefix('r', 'animdelay')"> | </span> <span onClick="vendorPrefix('ms', 'animdelay')">-ms-</span></p>
</section><script defer>
function changeTime(){
var speed = (document.getElementById('delayrange').value * 1).toFixed(1);
var seconds = document.querySelectorAll("#animdelay span.changer");
for(var i = 0, j = seconds.length; i < j; i++){
seconds[i].innerHTML = speed;
}
}
function changeDelay(){
var speed = (document.getElementById('delayrange').value * 1).toFixed(1);
document.getElementById('animationdelayi').style.webkitAnimation = "flyingTowardsUser 8s ease-in-out " + speed + 's 2';
/* document.getElementById('animationdelayi').style.webkitAnimationDuration = '8s';
document.getElementById('animationdelayi').style.webkitAnimationName = 'flyingTowardsUser';
document.getElementById('animationdelayi').style.webkitAnimationTimingFunction = 'ease-in-out';
document.getElementById('animationdelayi').style.webkitAnimationDelay = speed + 's';*/
console.log(speed);
var seconds = document.querySelectorAll("#animdelay span.changer");
for(var i = 0, j = seconds.length; i < j; i++){
seconds[i].innerHTML = speed;
}
}
</script>
</div>
<div class="slide" id="animdir"> <i></i>
<header>
<h1>‘animation-direction’</h1>
</header>
<b id="animationdir" class="plane planeanim">✈</b>
<section class="content">
<pre contenteditable>.plane {
...
<u></u>animation-name: flyingTowardsUser;
<u></u>animation-duration: 5s;
<u></u>animation-timing-function: ease-in-out;
<u></u>animation-iteration-count: 5;
<b><u></u>animation-direction: <span onclick="changeDirection('normal');" class="linky">normal</span></b>
}</pre>
<p>Two possible values: normal | alternate;</p>
<pre contenteditable><b><u></u>animation-direction: <span onclick="changeDirection('alternate');" class="linky">alternate</span>;</b></pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'animdir')">-webkit-</span><span onClick="vendorPrefix('r', 'animdir')"> | </span> <span onClick="vendorPrefix('m', 'animdir')">-moz-</span><span onClick="vendorPrefix('r', 'animdir')"> | </span> <span onClick="vendorPrefix('ms', 'animdir')">-ms-</span> </p>
</section>
<script>
function changeDirection(direction){
document.getElementById('animationdir').style.webkitAnimation = "flyingTowardsUser 5s ease-in-out 0.1s 5 "+ direction;
}
</script>
</div>
<div class="slide" id="animsh">
<header>
<h1>‘animation’ (shorthand)</h1>
</header>
<section class="content">
<pre contenteditable>.plane {
...
<u></u>animation-name: flyingTowardsUser;
<u></u>animation-duration: 5s;
<u></u>animation-delay: 100ms;
<u></u>animation-timing-function: ease-in-out;
<u></u>animation-iteration-count: 5;
<del><u></u>animation-direction: normal;</del>
}</pre>
<p>. . . can also be written as . . .
<pre contenteditable>
.plane {
...
<b><u></u>animation: flyingTowardsUser 5s ease-in-out 100ms 5</b>;
}</pre>
<p style="text-align:center"><span onClick="vendorPrefix('w', 'animsh')">-webkit-</span><span onClick="vendorPrefix('r', 'animsh')"> | </span> <span onClick="vendorPrefix('m', 'animsh')">-moz-</span><span onClick="vendorPrefix('r', 'animsh')"> | </span> <span onClick="vendorPrefix('ms', 'animsh')">-ms-</span> </p>
</section>
</div>
<div class="slide" id="animfm">
<header><h1>‘animation-fill-mode’</h1></header>
<b id="animationfm" class="plane planeanim">✈</b>
<section class="content">
<pre contenteditable onMouseDown="document.getElementById('animationfm').style.webkitAnimation = 'none';">values: <span onClick="changeFillMode(this.innerHTML)">none</span> | <span onClick="changeFillMode(this.innerHTML)">forwards</span> | <span onClick="changeFillMode(this.innerHTML)">backwards</span> | <span onClick="changeFillMode(this.innerHTML)">both</span></pre>
<pre contenteditable>.plane {
<u></u>animation-name: flyingTowardsUser;
<u></u>animation-duration: 3s;
<u></u>animation-timing-function: ease-in-out;
<u></u>animation-iteration-count: <span contenteditable id="fmitcount" onchange="document.getElementById('fmitcountres').innerHTML = this.innerHTML">1</span>
<u></u>animation-delay: 1s;
<b><u></u>animation-fill-mode: none;</b>
}</pre>
<p>. . . or . . .<span style="float: right; font-size: 80%"><span onClick="vendorPrefix('w', 'animfm')">-webkit-</span><span onClick="vendorPrefix('r', 'animfm')"> | </span> <span onClick="vendorPrefix('m', 'animfm')">-moz-</span><span onClick="vendorPrefix('r', 'animfm')"> | </span> <span onClick="vendorPrefix('ms', 'animfm')">-ms-</span> </p>
</p>
<pre contenteditable>
.plane {
<u></u>animation: flyingTowardsUser 3s ease-in-out 1s <b id="fmitcountres"></b> <b id="fmsh">forwards</b>;
}</pre>
</section>
<script>
function changeFillMode(fillMode){
var iteration = document.getElementById('fmitcount').innerHTML;
console.log(iteration);
document.getElementById('fmsh').innerHTML = fillMode;
document.getElementById('animationfm').style.webkitAnimation = "flyingTowardsUser 5s ease-in-out 1s " + iteration + " "+ fillMode;
}
</script>
</div>
<div class="slide" id="animps">
<header><h1>‘animation-play-state’</h1></header>
<section class="content">
<b class="plane plane_pausing">✈</b>
<pre contenteditable><u></u>animation-play-state: paused | running</pre>