Skip to content

Instantly share code, notes, and snippets.

@knxroot
Created November 11, 2012 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knxroot/4056328 to your computer and use it in GitHub Desktop.
Save knxroot/4056328 to your computer and use it in GitHub Desktop.
HTML5:canvas ejemplo básico
<!DOCTYPE html>
<html lang="en">
<head>
<title>Prueba Canvas</title>
<script type="text/javascript">
function dibujar()
{
var canvas=document.getElementById('miCanvas');
var ctx=canvas.getContext('2d');
ctx.fillRect(100,100,200,50);
ctx.moveTo(100,100);
ctx.lineTo(150,50);
ctx.lineTo(200,100);
ctx.lineTo(250,50);
ctx.lineTo(300,100);
//ctx.stroke();
ctx.fill();
}
</script>
</head>
<body onload="dibujar();">
<canvas id="miCanvas" width="300" height="150">
Tu navegador no soporta Canvas.
</canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment