Facebook
From Flying Bushbaby, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 155
  1. <!doctype html>
  2. <html>
  3. <head>
  4.   <title>2D Context</title>
  5.   <script>
  6.       window.onload = setup2d;
  7.  
  8.  
  9.       function setup2d() {
  10.           const canvas = document.getElementById("my-canvas");
  11.           const context = canvas.getContext('2d');
  12.  
  13.           context.strokeStyle = "#0000  b3";
  14.           context.lineWidth = 2;
  15.           context.beginPath();
  16.           context.fillStyle =  "#ff9933";
  17.           context.font = "italic 40px 'Arial'";
  18.           context.fillText("Nasza firma",10,70);
  19.  
  20.           context.moveTo(0, 80);
  21.           context.lineTo(260, 80);
  22.           context.lineTo(300, 30);
  23.           context.lineTo(340, 80);
  24.           context.lineTo(400, 80);
  25.           context.closePath();
  26.  
  27.  
  28.  
  29.  
  30.           context.fill();
  31.  
  32.  
  33.  
  34.  
  35.           context.stroke();
  36.       }
  37.       function random_rgba() {
  38.           var o = Math.round, r = Math.random, s = 255;
  39.           return 'rgba(' + o(r()*s) + ',' + o(r()*s) + ',' + o(r()*s) + ',' + r().toFixed(1) + ')';
  40.       }
  41.   </script>
  42.   <style>
  43.     #my-canvas {
  44.       background-color: yellow;
  45.     }
  46.   </style>
  47. </head>
  48. <body>
  49. <p>Jarosław Gryczan</p>
  50. <p>47184</p>
  51. <canvas id="my-canvas" width="400" height="400">
  52. </canvas>
  53.  
  54. </body>
  55. </html>
  56.