Skip to content

Instantly share code, notes, and snippets.

@ramayac
Created July 8, 2011 13:51
Show Gist options
  • Save ramayac/1071869 to your computer and use it in GitHub Desktop.
Save ramayac/1071869 to your computer and use it in GitHub Desktop.
Ejemplo sencillo/basico de página de HTML5 con elemento canvas
<html>
<head>
<script type="application/javascript">
function draw() {
var canvas = document.getElementById("canvas");
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 55, 50);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect (30, 30, 55, 50);
}
}
</script>
</head>
<body onload="draw();">
<canvas id="canvas" width="150" height="150"></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment