El "Hello World!" de Canvas HTML5
Iniciamos con un Hello World, donde se representa un canvas
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Introducción al Canvas</title>
<style>
canvas{
background:orange;
border: solid red 3px;
}
</style>
<script>
window.onload=function(){
canvas = document.getElementById("miCanvas");
if(canvas && canvas.getContext){
ctx = canvas.getContext("2d");
}
}
</script>
</head>
<body>
<h1>Introducción al canvas HTML5</h1>
<canvas id="miCanvas" width="600" height="400">
Tu navegador no soporta el canvas de HTML5
</canvas>
</body>
</html>
El resultado es este...
;P ...en dos palabras im... presionante!