Skip to content

Instantly share code, notes, and snippets.

@knxroot knxroot/gist:4056328
Created Nov 11, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.