-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1119 lines (1065 loc) · 40 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
<!--
Google IO 2012 HTML5 Slide Template
Authors: Eric Bidelman <[email protected]>
Luke Mahé <[email protected]>
URL: https://code.google.com/p/io-2012-slides
-->
<!DOCTYPE html>
<html>
<head>
<title>g|india</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">-->
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
<!--This one seems to work all the time, but really small on ipad-->
<!--<meta name="viewport" content="initial-scale=0.4">-->
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" media="all" href="theme/css/default.css">
<link rel="stylesheet" media="all" href="theme/css/add2.css">
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="theme/css/phone.css">
<base target="_blank"> <!-- This amazingness opens all links in a new tab. -->
<script data-main="js/slides" src="js/require-1.0.8.min.js"></script>
</head>
<body style="opacity: 0">
<slides class="layout-widescreen">
<slide class="logoslide nobackground">
<article class="flexbox vcenter">
<span><img src="images/google_developers_logo.png"></span>
</article>
</slide>
<slide class="title-slide segue nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<!-- The content of this hgroup is replaced programmatically through the slide_config.json. -->
<hgroup class="auto-fadein">
<h1 data-config-title id="mainTitle">
<span id="titleOther5" class="titleOther5">5</span>
<span id="titleH" class="titleH">H</span>
<span id="titleH2" class="titleH2">ere's </span>
<span id="titleT" class="titleT">T</span>
<span id="titleT2" class="titleT2">hat </span>
<span id="titleM" class="titleM">M</span>
<span id="titleM2" class="titleM2">agical </span>
<span id="titleL" class="titleL">L</span>
<span id="titleL2" class="titleL2">anguage </span>
<span id="title5" class="title5">5</span>
<br/></h1>
<h2 data-config-subtitle>More Magic Moments !</h2>
<p data-config-presenter><!-- populated from slide_config.json --></p>
</hgroup>
</slide>
<slide>
<hgroup>
<h2>HTML5</h2>
<h3>Taking web development to the next level.</h3>
</hgroup>
<article>
<ul class="build">
<li>Fast. Secure. Responsive. Interactive.<br/><br/></li>
<li>Stunningly beautiful. Lot of support for animation and graphics.<br/><br/></li>
<li>Provides ways to create as complex apps as desktop allows.<br/><br/></li>
<li>Bridges the gap between offline and online, 2D and 3D, server and client.<br/><br/></li>
<li>Much easier development.<br/><br/></li>
<li>Browsers more secure than ever.<br/><br/></li>
</ul>
</article>
</slide>
<!-- Whats in it -->
<slide hidden>
<hgroup>
<h2>HTML5</h2>
<h3>What's in it?</h3>
</hgroup>
<article>
<img src="images/html5logo.png" width="300" height="300" class="html5Image"></img>
<div class="html5_groups html5_css3">CSS3</div>
<div class="html5_groups html5_conn">Connectivity</div>
<div class="html5_groups html5_dev">Device Access</div>
<div class="html5_groups html5_perf">Performance & Integration</div>
<div class="html5_groups html5_3d">3D, Graphics & Effects</div>
<div class="html5_groups html5_off">Offline & Storage</div>
<div class="html5_groups html5_mult">Multimedia</div>
<div class="html5_groups html5_sem">Semantics</div>
</article>
</slide>
<!-- magic moment 1 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 1</h2>
<h3><br/></h3>
<div class="onestar"></div>
</hgroup>
</slide>
<!-- Rainbow Spiral Demo -->
<slide>
<hgroup>
<h2>The Rainbow Spiral</h2>
</hgroup>
<article>
<div class="rainbow1" id="rainbowOuter"></div>
<div class="rainbowTextDiv">
<span class="rainbowText">Number of figures: </span><input type="range" class="rainbowSlider" id="rainbowSlider1" value="60" max="200" min="4" onchange="renderRainbowEffect();"/>
<br/>
<span class="rainbowText">Angle of rotation: </span><input type="range" class="rainbowSlider" id="rainbowSlider2" value="15" max="360" min="0" onchange="renderRainbowEffect();"/>
</div>
</article>
</slide>
<script>
function renderRainbowEffect() {
var numFig = document.getElementById("rainbowSlider1").value;
var initialWidth = 400;
var rainbowDiff = parseInt(initialWidth / parseInt(numFig));
var rainbowAngleInitial = document.getElementById("rainbowSlider2").value;
var rainbowAngle = rainbowAngleInitial;
var rainbowParentDiv = document.getElementById("rainbowOuter");
rainbowParentDiv.innerHTML = "";
var center = 200;
for (var rainbowWidth = initialWidth; rainbowWidth > 0; rainbowWidth -= rainbowDiff) {
var rainbowNode = document.createElement("div");
rainbowNode.classList.add("rainbow");
rainbowNode.style.position = "absolute";
rainbowNode.style.top = (center - rainbowWidth/2) + "px";
rainbowNode.style.left = (center - rainbowWidth/2) + "px";
rainbowNode.style.height = rainbowWidth + "px";
rainbowNode.style.width = rainbowWidth + "px";
rainbowNode.style.webkitTransform = "rotate(" + rainbowAngle + "deg)";
rainbowAngle = (parseInt(rainbowAngle) + parseInt(rainbowAngleInitial)) % 360;
document.getElementById("rainbowOuter").appendChild(rainbowNode);
rainbowNode.style.display = "block";
rainbowWidth -= rainbowDiff;
}
}
renderRainbowEffect();
</script>
<!-- Rainbow spiral explained -->
<slide>
<hgroup>
<h2>The Rainbow Spiral - explained.</h2>
<h3>CSS3 gradients, CSS3 transforms.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="css">
<style>
div {
background-image: linear-gradient(left top, red 0%, orange 16%, yellow 33%,
green 50%, blue 67%, indigo 84%, violet 100%);
transform: rotate(20deg);
}
</style>
</pre>
<div class="rainbowExplain"></div>
</article>
</slide>
<!-- magic moment 2 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 2</h2>
<h3><br/></h3>
<div class="twostar"></div>
</hgroup>
</slide>
<!-- My favorite color -->
<slide>
<hgroup>
<h2>My Favorite Color</h2>
</hgroup>
<article>
<div id="googleSpeechInput" class="googleSpeechInput">Google</div>
<input id="speech-input-field" class="speechInputExample" onwebkitspeechchange="useColor(this.value);" type="text" x-webkit-speech />
</article>
</slide>
<!-- My favorite color -->
<slide>
<hgroup>
<h2>My Favorite Color - whitelisted.</h2>
<h3>text strokes, speech input.</h3>
</hgroup>
<pre class="prettyprint" data-lang="html">
<div id="googleText" class="googleText">Google</div>
<input type="text" class="speechInput"
onwebkitspeechchange="setColor(this.value);"
x-webkit-speech />
</pre>
<pre class="prettyprint" data-lang="css">
.googleText {
-webkit-text-fill-color: white;
-webkit-text-stroke-color: black;
-webkit-text-stroke-width: 1px;
text-shadow: 5px 5px 10px #202020;
}
.speechInput {
color: transparent;
background-color: transparent;
border: 0;
}
</pre>
</slide>
<!-- whitelisted 2 -->
<slide>
<hgroup>
<h2>My Favorite Color - whitelisted.</h2>
<h3>history API</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
function colorGoogle(color) {
$('googleText').webkitTextFillColor = color;
}
function setColor(color) {
colorGoogle(color);
var url = window.location.pathname + '#color=' + color;
window.location.href = url;
history.pushState(null, null, url);
}
window.addEventListener('popstate', function(e) {
var color = window.location.hash.split('=')[1] || 'white';
colorGoogle(color);
});
</pre>
</article>
</slide>
<!-- magic moment 3 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 3</h2>
<h3><br/></h3>
<div class="threestar"></div>
</hgroup>
</slide>
<!-- Rotating Cube -->
<slide id="rotatingCubeSlide">
<hgroup>
<h2>The Rotating Cube</h2>
</hgroup>
<article>
<div id="cubeOuter" class="cubeOuter">
<div id="cubeInner" class="cubeInner">
<div id="faceA" class="cubeFace cubeFaceA">
</div>
<div id="faceB" class="cubeFace cubeFaceB">
<div style="height:130px;"></div>HTML5 Rocks!
</div>
<div id="faceC" class="cubeFace cubeFaceC">
<video width="240" height="360" loop autoplay controls muted>
<source src="files/chrome.webm" type="video/webm" />
</video>
</div>
<div id="faceD" class="cubeFace cubeFaceD"><div style="height:50px;"></div>
<img src="images/AngryRedBird.png" width="200"></img>
</div>
<div id="faceE" class="cubeFace cubeFaceE"> opaque</div>
<div id="faceF" class="cubeFace cubeFaceF"></div>
</div>
</div>
</article>
<script>
setInterval(
function() {
document.getElementById('faceF').innerHTML = "<br/><br/>" + new Date().toString().split(" ")[4];
}
, 1000);
</script>
</slide>
<!-- Rotating Cube unfolded - 1 -->
<slide>
<hgroup>
<h2>The Rotating Cube - unfolded.</h2>
<h3>step 1: Get the HTML and basic CSS right.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="css">
<div id="cubeOuter" class="cubeOuter">
<div class="cubeFace cubeFaceA"> 1 </div>
<!-- other five faces go here -->
</div>
</pre>
<pre class="prettyprint" data-lang="css">
.cubeFace {
border: 2px solid black; border-radius: 5px; height: 100%; width: 100%;
position: absolute; left: 0px; top: 0px;
}
.cubeFaceA {
background: rgba(255, 0, 0, 0.5);
}
/* Other five styles go here. */
</pre>
</article>
<div class="cubeExample cubeExample1">1</div>
<div class="cubeExample cubeExample2">2</div>
<div class="cubeExample cubeExample3">3</div>
<div class="cubeExample cubeExample4">4</div>
<div class="cubeExample cubeExample5">5</div>
<div class="cubeExample cubeExample6">6</div>
</slide>
<!-- Rotating Cube unfolded - 2 -->
<slide>
<hgroup>
<h2>The Rotating Cube - unfolded.</h2>
<h3>step 2: Get the rotations right.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="css">
.cubeFaceA { -webkit-transform: rotateY(0deg); }
.cubeFaceB { -webkit-transform: rotateY(-90deg); }
.cubeFaceC { -webkit-transform: rotateY(180deg); }
.cubeFaceD { -webkit-transform: rotateY(90deg); }
.cubeFaceE { -webkit-transform: rotateX(90deg); }
.cubeFaceF { -webkit-transform: rotateX(-90deg); }
</pre>
</article>
<div class="cubeExample cubeExample11">1</div>
<div class="cubeExample cubeExample21">2</div>
<div class="cubeExample cubeExample31">3</div>
<div class="cubeExample cubeExample41">4</div>
<div class="cubeExample cubeExample51">5</div>
<div class="cubeExample cubeExample61">6</div>
<div class="cubeEx cubeEx1">1</div>
<div class="cubeEx cubeEx2">2</div>
<div class="cubeEx cubeEx3">3</div>
<div class="cubeEx cubeEx4">4</div>
<div class="cubeEx cubeEx5">5</div>
<div class="cubeEx cubeEx6">6</div>
<script>
document.querySelector(".cubeEx6").addEventListener("mouseover", function() {
document.querySelector(".cubeEx6").classList.add("cubeEx6H");
document.querySelector(".cubeEx5").classList.add("cubeEx5H");
document.querySelector(".cubeEx4").classList.add("cubeEx4H");
document.querySelector(".cubeEx3").classList.add("cubeEx3H");
document.querySelector(".cubeEx2").classList.add("cubeEx2H");
document.querySelector(".cubeEx1").classList.add("cubeEx1H");
}, false);
document.querySelector(".cubeEx6").addEventListener("mouseout", function() {
document.querySelector(".cubeEx6").classList.remove("cubeEx6H");
document.querySelector(".cubeEx5").classList.remove("cubeEx5H");
document.querySelector(".cubeEx4").classList.remove("cubeEx4H");
document.querySelector(".cubeEx3").classList.remove("cubeEx3H");
document.querySelector(".cubeEx2").classList.remove("cubeEx2H");
document.querySelector(".cubeEx1").classList.remove("cubeEx1H");
}, false);
</script>
</slide>
<!-- Rotating Cube unfolded - 3 -->
<slide>
<hgroup>
<h2>The Rotating Cube - unfolded.</h2>
<h3>step 3: Get the perspective right.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="css">
.cubeOuter {
-webkit-perspective: 1200;
-webkit-perspective-origin: 300px 200px;
-webkit-transition: -webkit-transform 2s;
}
.cubeFaceA { -webkit-transform: rotateY(0deg) <b>translateZ(150px);</b> }
.cubeFaceB { -webkit-transform: rotateY(-90deg) <b>translateZ(150px);</b> }
.cubeFaceC { -webkit-transform: rotateY(180deg) <b>translateZ(150px);</b> }
.cubeFaceD { -webkit-transform: rotateY(90deg) <b>translateZ(150px);</b> }
.cubeFaceE { -webkit-transform: rotateX(90deg) <b>translateZ(150px);</b> }
.cubeFaceF { -webkit-transform: rotateY(-90deg) <b>translateZ(150px);</b> }
</pre>
</article>
<div class="cubeFxOuter">
<div class="cubeFx cubeFx1">1</div>
<div class="cubeFx cubeFx2">2</div>
<div class="cubeFx cubeFx3">3</div>
<div class="cubeFx cubeFx4">4</div>
<div class="cubeFx cubeFx5">5</div>
<div class="cubeFx cubeFx6">6</div>
</div>
<span style="position:absolute; top: 540px; left: 890px; font-size:16px;">
<a href="http://jsbin.com/iwodux/4/edit" style="margin-left:-130px;">non-commutative transformations</a><div style="height:10px;"></div>
<input type="checkbox" onclick="var nd = document.querySelector('.cubeFxOuter'); this.checked ? nd.classList.add('cubeFxOuterP') : nd.classList.remove('cubeFxOuterP');" />use perspective.<div style="height:5px;"></div>
<input type="checkbox" onclick="var nd = document.querySelector('.cubeFxOuter'); this.checked ? nd.classList.add('cubeFxOuterT') : nd.classList.remove('cubeFxOuterT');" />transform origin.
</span>
</slide>
<script>
document.querySelector(".cubeFx6").addEventListener("mouseover", function() {
document.querySelector(".cubeFx6").classList.add("cubeFx6H");
document.querySelector(".cubeFx5").classList.add("cubeFx5H");
document.querySelector(".cubeFx4").classList.add("cubeFx4H");
document.querySelector(".cubeFx3").classList.add("cubeFx3H");
document.querySelector(".cubeFx2").classList.add("cubeFx2H");
document.querySelector(".cubeFx1").classList.add("cubeFx1H");
}, false);
document.querySelector(".cubeFx6").addEventListener("mouseout", function() {
document.querySelector(".cubeFx6").classList.remove("cubeFx6H");
document.querySelector(".cubeFx5").classList.remove("cubeFx5H");
document.querySelector(".cubeFx4").classList.remove("cubeFx4H");
document.querySelector(".cubeFx3").classList.remove("cubeFx3H");
document.querySelector(".cubeFx2").classList.remove("cubeFx2H");
document.querySelector(".cubeFx1").classList.remove("cubeFx1H");
}, false);
</script>
<!-- Rotating cube unfolded - 4 -->
<slide>
<hgroup>
<h2>The Rotating Cube - unfolded.</h2>
<h3>step 4: Get the JavaScript right.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript" style="line-height:1.3em;">
var rotateX = 0, rotateY = 0, rotateZ = 0, diff = 90;
function rotateCube(e) {
switch(e.keyCode) {
case 49: rotateY -= diff; break;
case 50: rotateY += diff; break;
case 51: rotateX += diff; break;
case 52: rotateX -= diff; break;
case 53: rotateZ += diff; break;
case 54: rotateZ -= diff; break;
}
var rX = "rotateX(" + rotateX + "deg) ";
var rY = "rotateY(" + rotateY + "deg) ";
var rZ = "rotateZ(" + rotateZ + "deg) ";
$("cubeOuter").style.webkitTransform = rX + rY + rZ;
}
document.addEventListener('keypress', rotateCube, false);
</pre>
</article>
</slide>
<!-- magic moment 4 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 4</h2>
<h3><br/></h3>
<div class="onestar"></div>
</hgroup>
</slide>
<!-- You are here. -->
<slide>
<hgroup>
<h2>You Are Here!</h2>
</hgroup>
<input type="button" value="Show location" class="showLocationBtn" onclick="showLocation();" />
<span id="geolog" class="geoLog"></span>
<div id="geomap" class="geoMapExample">
<img src="http://maps.google.com/maps/api/staticmap?center=37.4419,-94.1419&zoom=1&scale=2&size=400x200&sensor=true" />
</div>
</slide>
<!-- you are here - grounded. -->
<slide>
<hgroup>
<h2>You Are Here - grounded.</h2>
<h3>navigator.geoLocation, google Maps APIs</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
<b>navigator.geolocation.getCurrentPosition</b>(
function(position) { // Success handler.
var acc = <b>position.coords.accuracy;</b>
var lat = <b>position.coords.latitude;</b>
var log = <b>position.coords.longitude;</b>
var geoMap = document.getElementById("mapDiv");
var map = new google.maps.Map(geoMap, { });
var latLng = new google.maps.LatLng(lat, log);
new google.maps.Marker({position: latLng, map: map});
map.setCenter(latLng);
map.setZoom(15);
},
function(evt) { // Error handler.
}
);
</pre>
</article>
</slide>
<!-- magic moment 5 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 5</h2>
<h3><br/></h3>
<div class="twostar"></div>
</hgroup>
</slide>
<!-- Bend It Like Beckham -->
<slide>
<hgroup>
<h2>
Bend It Like Beckham
</h2>
</hgroup>
<article>
<div>
<div id="orientationWrap" style="position:absolute; top: 180px; left: 350px;">
<div class="layer" style="position: absolute; left: 0px; top: 0px; transform: rotateY(0deg) rotateX(0deg); "><img src="images/chrome-layer-01.png"></div>
<div class="layer" style="position: absolute; left: 0px; top: 0px; transform: rotateY(0deg) rotateX(0deg); "><img src="images/chrome-layer-02.png"></div>
<div class="layer" style="position: absolute; left: 0px; top: 0px; transform: rotateY(0deg) rotateX(0deg); "><img src="images/chrome-layer-03.png"></div>
<div class="layer" style="position: absolute; left: 0px; top: 0px; transform: rotateY(0deg) rotateX(0deg); "><img src="images/chrome-layer-04.png"></div>
<div class="layer" style="position: absolute; left: 0px; top: 0px; transform: rotateY(0deg) rotateX(0deg); "><img src="images/chrome-layer-05.png"></div>
</div>
</div>
</article>
</slide>
<!-- Bend It Like Beckham - straightened-->
<slide>
<hgroup>
<h2>Bend It Like Beckham - straightened.</h2>
<h3>device orientation, CSS3 transforms.</h3>
</hgroup>
<br/>
<pre class="prettyprint" data-lang="javascript">
window.addEventListener('deviceorientation', function(event) {
var alpha = event.alpha; // direction.
var beta = event.beta, // front-to-back tit.
var gamma = event.gamma; // left-to-right tilt.
var layers = document.querySelectorAll('.layer');
for (var i = 0, zindex = 1, elem; elem = layers[i]; ++i, ++zindex) {
var x = Math.round(1.5 * gamma * zindex);
var y = Math.round(1.5 * beta * zindex);
elem.style.left = x.toString() + 'px';
elem.style.top = y.toString() + 'px';
elem.style.webkitTransform =
'rotateY(' + (-2.0 * gamma) + 'deg) rotateX(' + (-2.0 * beta) + 'deg)';
}
}, false);
</pre>
</slide>
<!-- magic moment 6 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 6</h2>
<h3><br/></h3>
<div class="threestar"></div>
</hgroup>
</slide>
<!-- Spinning Chrome -->
<slide>
<hgroup>
<h2>The Spinning Chrome</h2>
</hgroup>
<article>
<img src="images/chrome2.png" id="spinningChrome" width="550" height="550" class="chromeLogo chromeLogoOnline" />
<img src="images/sadface.png" id="sadFace" width="180" height="180" class="noSadFace" style="position:absolute; top: 285px; left:435px;">
</article>
</slide>
<script>
var chromeStatusElem = document.getElementById('spinningChrome');
setInterval(function () {
if (navigator.onLine) {
chromeStatusElem.style.webkitAnimationPlayState = "running";
} else {
chromeStatusElem.style.webkitAnimationPlayState = "paused";
}
}, 250);
document.addEventListener('webkitvisibilitychange', function(e) {
if (document.webkitHidden == false) {
setTimeout(function() { if(document.webkitHidden == false) document.getElementById('sadFace').classList.add("noSadFace"); }, 3000);
} else {
document.getElementById('sadFace').classList.remove("noSadFace");
}
}, false);
</script>
<!-- spinning chrome pinned -->
<slide>
<hgroup>
<h2>The Spinning Chrome - pinned.</h2>
<h3>keyframes, animations, navigator.onLine, visibilitychange, hidden
</hgroup>
<pre class="prettyprint" data-lang="css">
@keyframes spin { from {transform: rotate(0); } to {transform: rotate(-2160deg); } }
.chromeLogo { animation:spin 12s infinite cubic-bezier(0.9, 0.1, 0.1, 0.9); }
</pre>
<pre class="prettyprint" data-lang="javascript">
var chromeElem = document.getElementById('chromeLogo');
setInterval(function () {
chromeElem.style.<b>webkitAnimationPlayState</b> == <b>navigator.onLine</b> ? "running" : "paused";
}, 250);
document.addEventListener('<b>webkitvisibilitychange</b>', function(e) {
if (<b>document.webkitHidden</b> == true) $('sadFace').classList.remove("invisible");
else setTimeout(
function() {
if (document.webkitHidden == false) $('sadFace').classList.add("invisible");
}, 2000);
}, false);
</pre>
</slide>
<!-- magic moment 7 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 7</h2>
<h3><br/></h3>
<div class="fourstar"></div>
</hgroup>
</slide>
<!-- bouncing ball demo -->
<slide>
<hgroup>
<h2>The Bouncing Ball</h2>
<h3></h3>
</hgroup>
<article>
<canvas width="800" height="400" id="canvas" class="canvas"></canvas>
<input type="button" style="position:absolute; left:950px; top: 530px;font-size:48px;" value="start" onclick="runCanvasDemo();" />
</article>
<span style="position:absolute; top: 580px;left:300px;font-size:18px;">Source: <a href="http://billmill.org/static/canvastutorial/">http://billmill.org/static/canvastutorial/</a></span>
</slide>
<!-- bouncing ball caught -1 -->
<slide>
<hgroup>
<h2>The Bouncing Ball - caught.</h2>
<h3>Step 1: Draw the individual components.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="html">
<canvas id="canvas" width="800" height="500"></canvas>
</pre>
<pre class="prettyprint" data-lang="javascript">
function initCanvasDemo() {
ctx = $('canvas').getContext("2d");
}
function circle(x, y, r, color) {
ctx.beginPath();
ctx.arc(x, y, r, 0, Math.PI*2, true);
ctx.closePath();
ctx.fillStyle = color; ctx.fill();
}
function rect(x, y, w, h, color) {
ctx.beginPath(); ctx.rect(x,y,w,h); ctx.closePath();
ctx.fillStyle = color; ctx.fill();
}
</pre>
<canvas id="canvasExample1" width=250 height=250 style="border:1px solid black;background-color: black;position: absolute; left:750px; top:340px;"></canvas>
<script>
var ctxe = document.getElementById("canvasExample1").getContext("2d");
ctxe.beginPath();
ctxe.arc(150, 200, 30, 0, Math.PI*2, true);
ctxe.closePath();
ctxe.fillStyle = "#DD0000"; ctxe.fill();
ctxe.beginPath(); ctxe.rect(20,20,100,40); ctxe.closePath();
ctxe.fillStyle = "#A0CC30"; ctxe.fill();
</script>
</article>
</slide>
<!-- Bouncing ball caught - 2 -->
<slide>
<hgroup>
<h2>The Bouncing Ball - caught.</h2>
<h3>Step 2: Add motion to the ball.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
function draw() {
clear("#000000");
circle(x, y, 10);
if (x + dx > canvasWidth || x + dx < 0) dx = -dx;
if (y + dy > canvasHeight || y + dy < 0) dy = -dy;
x += dx;
y += dy;
}
function clear(backColor) {
ctx.fillStyle = backColor;
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.beginPath(); ctx.rect(0,0,canvasWidth,canvasHeight);
ctx.closePath(); ctx.fill();
}
setInterval(draw, 10);
</pre>
</article>
<canvas id="canvasExample2" width=250 height=250 style="border:1px solid black;background-color: black;position: absolute; left:750px; top:340px;"></canvas>
<script>
var ctxe2 = document.getElementById("canvasExample2").getContext("2d");
var canvasE2X = 100;
var canvasE2Y = 100;
var canvasWidth = 250;
var canvasHeight = 250;
var canvasE2dx = 1.5;
var canvasE2dy = -4;
function drawCanvasExample2() {
clearCanvasExample2("red");
circleCanvasExample2(canvasE2X, canvasE2Y, 10, "black");
if (canvasE2X + canvasE2dx > canvasWidth || canvasE2X + canvasE2dx < 0) canvasE2dx = -canvasE2dx;
if (canvasE2Y + canvasE2dy > canvasHeight || canvasE2Y + canvasE2dy < 0) canvasE2dy = -canvasE2dy;
canvasE2X += canvasE2dx;
canvasE2Y += canvasE2dy;
}
function clearCanvasExample2(backColor) {
ctxe2.fillStyle = backColor;
ctxe2.clearRect(0, 0, canvasWidth, canvasHeight);
ctxe2.beginPath(); ctxe2.rect(0,0,canvasWidth,canvasHeight); ctxe2.closePath();
ctxe2.fill();
}
function circleCanvasExample2(x, y, r, color) {
ctxe2.arc(x, y, r, 0, Math.PI*2, true);
ctxe2.closePath();
ctxe2.fillStyle = color; ctxe2.fill();
}
setInterval(drawCanvasExample2, 10);
</script>
</slide>
<!-- Bouncing ball caught 3 -->
<slide>
<hgroup>
<h2>The Bouncing Ball - caught.</h2>
<h3>Step 3: Restrict bouncing from the handle.</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
function draw() {
clear("#000000"); circle(x, y, 10);
if (x + dx > canvasWidth || x + dx < 0) dx = -dx;
if (y + dy > canvasHeight || y + dy < 0) dy = -dy;
// Bounce off the ball only on colliding with the handle.
<b>if (x > handleX && x < handleX + handleW) dy = -dy;</b>
<b>else clearInterval(intervalId);</b>
x += dx; y += dy;
}
function onMouseMove(evt) {
if (evt.pageX > canvasMinX && evt.pageX < canvasMaxX) {
handleX = evt.pageX - canvasMinX;
}
}
document.addEventListener("mousemove", onMouseMove, false);
</pre>
</article>
</slide>
<!-- magic moment 8 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 8</h2>
<h3><br/></h3>
<div class="fourstar"></div>
</hgroup>
</slide>
<!-- HTML5 Piano -->
<slide>
<hgroup>
<h2>HTM5 Piano</h2>
<h3></h3>
</hgroup>
<article>
<div class="piano">
<div class="redline"></div>
<div id="ma" class="white key"></div>
<div id="ma_" class="black key b1"></div>
<div id="pa" class="white key"></div>
<div id="dha_" class="black key b2"></div>
<div id="dha" class="white key"></div>
<div id="ni_" class="black key b3"></div>
<div id="ni" class="white key"></div>
<!-- octave 1 -->
<div id="Sa" class="white key"></div>
<div id="Re_" class="black key b4"></div>
<div id="Re" class="white key"></div>
<div id="Ga_" class="black key b5"></div>
<div id="Ga" class="white key"></div>
<div id="Ma" class="white key"></div>
<div id="Ma_" class="black key b6"></div>
<div id="Pa" class="white key"></div>
<div id="Dha_" class="black key b7"></div>
<div id="Dha" class="white key"></div>
<div id="Ni_" class="black key b8"></div>
<div id="Ni" class="white key"></div>
<!-- octave 2 -->
<div id="SA" class="white key"></div>
<div id="RE_" class="black key b9"></div>
<div id="RE" class="white key"></div>
<div id="GA_" class="black key b10"></div>
<div id="GA" class="white key"></div>
<div id="MA" class="white key"></div>
<div id="MA_" class="black key b11"></div>
<div id="PA" class="white key"></div>
<div id="DHA_" class="black key b12"></div>
<div id="DHA" class="white key"></div>
<div id="NI_" class="black key b13"></div>
<div id="NI" class="white key"></div>
</div>
<div style="font-size:16px;float:right;margin-top:35px;margin-right:50px;">css inspiration: <a href="http://www.html5piano.ilinov.eu/">http://www.html5piano.ilinov.eu</a></div>
<input type="button" style="margin-left:20px;margin-top: 35px;" value="happy birthday!" onclick="playHappyBirthday();"/>
</article>
</slide>
<script>
var hbdCurKey = 0;
var divHBD = ["Sa", "Sa", "Re", "Sa", "Ma", "Ga", /**/ "Sa", "Sa", "Re", "Sa", "Pa", "Ma", /**/ "Sa", "Sa", "Dha", "Pa", "Ma", "Ga", "Re", /**/ "Ni_", "Ni_", "Dha", "Ma", "Pa", "Ma"];
//SaSa Re-Sa Ma-Ga : Happy Birthday to you
//SaSa Re-Sa Pa-Ma : Happy Birthday to you
//SaSa Dha-Pa MaMa Ga-Re : Happy Birthday dear friend
//nini Dha-Ma Pa-Ma : Happy Birthday to you
function fireEvent(element,event) {
if (document.createEvent) {
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
} else {
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
}
}
function playHappyBirthday() {
if (hbdCurKey < divHBD.length) {
if (hbdCurKey > 0) {
document.getElementById(divHBD[hbdCurKey-1]).classList.remove("pressed");
}
fireEvent(document.getElementById(divHBD[hbdCurKey]), "mousedown");
document.getElementById(divHBD[hbdCurKey]).classList.add("pressed");
hbdCurKey++;
setTimeout(playHappyBirthday, 500);
} else {
document.getElementById(divHBD[hbdCurKey-1]).classList.remove("pressed");
hbdCurKey = 0;
}
}
</script>
<!-- HTML5 Piano Cracked -->
<slide>
<hgroup>
<h2>HTML5 Piano - cracked.</h2>
<h3>The audio header</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
var header = new Uint8Array([
0x52,0x49,0x46,0x46, // "RIFF"
0, 0, 0, 0, // put total size here
0x57,0x41,0x56,0x45, // "WAVE"
0x66,0x6d,0x74,0x20, // "fmt "
16,0,0,0, // size of the following
1, 0, // PCM format
1, 0, // Mono: 1 channel
0x44,0xAC,0,0, // 44,100 samples per second
0x88,0x58,0x01,0, // byte rate: two bytes per sample
2, 0, // aligned on every two bytes
16, 0, // 16 bits per sample
0x64,0x61,0x74,0x61, // "data"
0, 0, 0, 0 // put number of samples here
]).buffer; // Note: we just want the ArrayBuffer.
</pre>
</article>
</slide>
<!-- HTML5 Piano Cracked - 2-->
<slide>
<hgroup>
<h2>HTML5 Piano - cracked.</h2>
<h3>Audio synthesis</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
function makeWave(samples) {
var bb = new WebKitBlobBuilder();
var dv = new DataView(header);
dv.setInt32(4, 36 + samples.length, true);
dv.setInt32(40, samples.length, true);
bb.append(header);
bb.append(samples.buffer);
return bb.getBlob('audio/wav');
}
</pre>
</article>
</slide>
<!-- HTML5 Piano Cracked - 3-->
<slide>
<hgroup>
<h2>HTML5 Piano - cracked.</h2>
<h3>Playing the audio</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="javascript">
function playNote(frequency, duration) {
var samplespercycle = 44100 / frequency;
var samples = new Uint16Array(44100 * duration);
var da = 2 * Math.PI / samplespercycle;
for (var i = 0, a = 0; i < samples.length; i++, a += da) {
samples[i] = Math.floor(Math.sin(a) * 32768);
}
var blob = makeWave(samples);
var url = window.webkitURL.createObjectURL(blob);
var player = new Audio(url);
player.play();
player.addEventListener('ended',
function(e) {window.webkitURL.revokeObjectURL(url);}, false);
}
</pre>
<span style="font-weight:bold;position:absolute;top:650px;left:200px;font-size:16px;color:#800000;">
Frequency: <input type="number" value="220" style="width:50px;" id="audioExampleFreq"/>
<input type="button" value="play note" id="playNoteExampleBtn();" onclick="document.getElementById('audioExampleUrl').value=playNote(document.getElementById('audioExampleFreq').value, 2);">
URL: <input type="text" id="audioExampleUrl" value="" style="border:1px solid #800000;" size="90"></input>
</div>
</article>
</slide>
<!-- magic moment 9 -->
<slide class="segue dark nobackground">
<aside class="gdbar"><img src="images/google_developers_icon_128.png"></aside>
<hgroup class="auto-fadein">
<h2>Magic Moment 9</h2>
<h3><br/></h3>
<div class="fivestar"></div>
</hgroup>
</slide>
<!-- HTML5 Terminal -->
<slide>
<hgroup>
<h2>HTML5 Terminal</h2>
</hgroup>
<article>
<iframe style="margin-top:-20px;" data-src="http://www.htmlfivewow.com/demos/terminal/terminal.html"></iframe>
</article>
<span style="font-size:16px;margin-left: 250px;"><b>source</b>: <a href="http://www.htmlfivewow.com/demos/terminal/terminal.html">http://www.htmlfivewow.com/demos/terminal/terminal.html</a></span>
</slide>
<!-- HTML Terminal demystified 1 -->
<slide>
<hgroup>
<h2>HTML5 Terminal - demystified.</h2>
<h3>draggable, ondragstart, ondragover, ondrop</h3>
</hgroup>
<article>
<pre class="prettyprint" data-lang="html">
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event);" />
<img src="images/sky.jpg" draggable="true" ondragstart="drag(event);" />
</pre>
<pre class="prettyprint" data-lang="javascript" style="width:700px;">
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData("Text",ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
</pre>
</article>
<article>
<div id="dragDropExample">
<div id="dragDropDestId" class="dragDropDest" ondrop="drop(event);" ondragover="allowDrop(event);" />
<div style="height: 150px;"></div>
<img src="images/sky.jpg" style="float:left;" width="100" height="100" draggable="true" ondragstart="drag(event);" id="drag1" />
</div>
<script>
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData("Text",ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
</script>
</article>
</slide>
<!-- HTML Terminal demystified 2 -->