Created
November 11, 2012 21:28
-
-
Save knxroot/4056328 to your computer and use it in GitHub Desktop.
HTML5:canvas ejemplo básico
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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