CanvasI


SUBMITTED BY: Guest

DATE: May 17, 2014, 9:18 p.m.

FORMAT: HTML

SIZE: 1.1 kB

HITS: 693

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>HTML5 - CANVAS I</title>
  5. <script type="text/javascript">
  6. <!--
  7. function cargador()
  8. {
  9. var lienzo = document.getElementById('lienzo') /* aqui se pone el id del canvas */
  10. var lienzo1 = lienzo.getContext('2d') /* aqui se pone 2d xq vamos a dibujar rectangulos en 2d */
  11. lienzo1.fillStyle = "rgba(0,0,200,1)"; /* rgba(r,g,b,A) / A esta en [0,1], A factor de visibilidad) */
  12. lienzo1.fillRect(20,20,150,100); /* fillRect(x,y,w,h) */
  13. lienzo1.fillStyle = "rgba(80,250,180,0.5)"; /* aquí A=0.5 osea el 50% */
  14. lienzo1.fillRect(130,90,30,80);
  15. lienzo1.fillStyle = "rgba(240,150,80,0.8)"; /* aquí A=0.8 osea el 80% */
  16. lienzo1.fillRect(150,100,30,80);
  17. }
  18. // -->
  19. </script>
  20. </head>
  21. <body onload="cargador()">
  22. <h1>Ejem Lienzo I</h1>
  23. <!-- El tag canvas con su id -->
  24. <canvas id="lienzo" width="600" height="300">
  25. </canvas>
  26. <hr />
  27. <iframe src="http://pastebin.com/embed_iframe.php?i=GmniWB59" style="border:none;width:100%" width="100%" height="500px"></iframe>
  28. </body>
  29. </html>

comments powered by Disqus