--enable-webgl flag.
Arne Roomann-Kurrik
Mihai Florin Ionescu
May 19, 2010
View live notes and ask questions about
this session on Google Wave:
View the source for this presentation:
This presentation was built using HTML5:
Press → to advance.
Low level control over rendering
var canvas = document.getElementById("canvas2d");
var context = canvas.getContext("2d");
context.moveTo(x1, y1); context.lineTo(x2, y2);
context.arc(x, y, r, Math.PI * 1/2, Math.PI * 3/2, false);
var id = context.getImageData(0, 0, width, height).data; var r = id[0], g = id[1], b = id[2], a = id[3] / 255;
context.lineWidth = 20; context.lineCap = "round"; context.strokeStyle = "rgba(255, 0, 0, 0.7)"; context.stroke();
<canvas id="canvas"></canvas>
<script>
var gl = document.getElementById("canvas").getContext("experimental-webgl");
gl.viewport(0, 0, canvas.width, canvas.height);
</script>
A richer experience with sound and video
<audio src="sound.ogg" controls></audio>
<script>
document.getElementById("audio").muted=false;
</script>
<video src='movie.webm' autoplay controls ></video>
<script>
document.getElementById("video").play();
</script>
Storing and processing complex data
var loadedCount = parseInt(localStorage['loadedCount'] || '0') + 1;
localStorage['loadedCount'] = loadedCount;
document.getElementById('displayLoadedCount').innerHTML = loadedCount;
You've viewed this presentation on this computer X times.
var db = window.openDatabase("Database Name", "Database Version");
db.transaction(function(tx) {
tx.executeSql("SELECT * FROM author", [], successCallback, errorCallback);
});



main.js:
var worker = new Worker(‘extra_work.js');
worker.onmessage = function (event) { alert(event.data); };
extra_work.js:
postMessage(some_data);
Paint here
Difference
Interacting with the client Operating System
var elem = document.getElementById('dragElem');
elem.addEventListener('dragstart', ..., false);
elem.addEventListener('dragend', ..., false);
var target = document.getElementById('dragTarget');
target.addEventListener('dragenter', ..., false);
target.addEventListener('dragleave', ..., false);
target.addEventListener('dragover', ..., false);
target.addEventListener('drop', ..., false);
if (window.webkitNotifications.checkPermission() == 0) {
window.webkitNotifications.createNotification(picture, title, text).show();
} else {
window.webkitNotifications.requestPermission();
}
This presentation currently X permission to display notifications.
Making things look good
font-family: Molengo Droid Serif Cantal Lobster Josefin color: ; H: S: L: background-color: ; H: S: L: -webkit-box-reflect: below 10px -webkit-gradient( linear, left top, left bottom, from(transparent), to(rgba(255, 255, 255, 0))); Reflection: text-shadow: ; Shadow: border-radius: ; Radius:
-webkit-transform: rotate(-10deg) scale(1.5);
| rotate(-45deg) | rotate(-15deg) | rotate(15deg) | rotate(45deg) | rotate(75deg) |
|---|---|---|---|---|
|
|
|
|
|
| scale(0.2) | scale(0.5) | scaleX(0.5) | scaleX(2.0) | scaleY(1.5) |
|
|
|
|
|
| skewX(10deg) | skewX(20deg) | skewX(30deg) | skewX(40deg) | skewX(50deg) |
|
|
|
|
|
.myDiv { -webkit-transition: -webkit-transform 2s ease-in-out; }
.myDiv:hover { -webkit-transform: rotate(-20deg); }
@-webkit-keyframes pulse {
0% { -webkit-transform: scale(2) rotate(5deg); }
50% { -webkit-transform: scale(5) rotate(-15deg); }
100% { -webkit-transform: scale(2) rotate(5deg); }
}
div {
-webkit-animation-name: pulse;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-direction: alternate;
}
*Please make a better use of it. We don't want a new <blink> tag ;)
@font-face {
font-family: 'Molengo';
src: local('Molengo'), url('fonts/Molengo.otf') format('opentype');
}
div { font-family: 'Molengo'; }
Stop abusing the pulse animation or else...
Now for some exciting
demos!
Chris Phenner, EVP of Business Development
Mike Park, Director of Product
Iain Dodsworth, CEO and Founder