Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <canvas id="myCanvas" width="2000" height="1200" style="border:1px solid #d3d3d3;">
  6. Your browser does not support the HTML5 canvas tag.</canvas>
  7.  
  8. <script>
  9.  
  10. var c = document.getElementById("myCanvas");
  11. var ctx = c.getContext("2d");
  12.  
  13.  
  14. // Red rectangle
  15. ctx.beginPath();
  16. ctx.lineWidth = "6";
  17. ctx.strokeStyle = "red";
  18. ctx.rect(5, 180, 190, 140);
  19. ctx.stroke();
  20.  
  21. // Green rectangle
  22. ctx.beginPath();
  23. ctx.moveTo( 2100, 100 );
  24. ctx.lineWidth = "4";
  25. ctx.strokeStyle = "green";
  26. ctx.rect(50, 100, 50, 70);
  27. ctx.stroke();
  28.  
  29. // Blue rectangle
  30. ctx.beginPath();
  31. ctx.moveTo( 190, 140 );
  32. ctx.lineWidth = "10";
  33. ctx.strokeStyle = "blue";
  34. ctx.rect(5, 10, 150, 80);
  35. ctx.stroke();
  36.  
  37. // Fill with yello
  38. ctx.fillStyle = "yellow";
  39. ctx.fillRect(250,10,55,60);
  40.  
  41. // Fill with purple
  42. ctx.fillStyle = "purple";
  43. ctx.fillRect(250,150,100,40);
  44.  
  45. // Fill with yello
  46. ctx.fillStyle = "gray";
  47. ctx.fillRect(250,200,345,80);
  48.  
  49. ctx.fillStyle = "black";
  50. ctx.font = "30px Arial";
  51. ctx.fillText("Zadanie 2", 10, 350);
  52.  
  53. ctx.beginPath();
  54. ctx.moveTo(75, 400);
  55. ctx.lineTo(100, 425);
  56. ctx.lineTo(100, 375);
  57. ctx.fill();
  58.  
  59. ctx.beginPath();
  60. ctx.moveTo(175, 400);
  61. ctx.lineTo(200, 440);
  62. ctx.lineTo(100, 475);
  63. ctx.fill();
  64.  
  65. ctx.fillText("Zadanie 3", 10, 550);
  66.  
  67. // Red rectangle
  68. ctx.beginPath();
  69. ctx.lineWidth = "6";
  70. ctx.fillStyle = "red";
  71. ctx.fillRect(50, 560, 200, 200);
  72. ctx.clearRect(50, 560, 30, 30);
  73. ctx.clearRect(220, 560, 30, 30);
  74. ctx.clearRect(50, 730, 30, 30);
  75. ctx.clearRect(220, 730, 30, 30);
  76.  
  77. ctx.stroke();
  78. ctx.fillStyle = "black";
  79. ctx.fillText("Zadanie 4", 10,800);
  80.  
  81.  
  82. ctx.beginPath();
  83. ctx.arc(95, 850, 40, 0, 2 * Math.PI);
  84. ctx.stroke();
  85.  
  86. ctx.beginPath();
  87. ctx.arc(95, 850, 40, 0, 2 * Math.PI);
  88. ctx.stroke();
  89.  
  90. ctx.beginPath();
  91. ctx.arc(195, 850, 40, 0, 1 * Math.PI);
  92. ctx.stroke();
  93.  
  94. ctx.beginPath();
  95. ctx.arc(295, 850, 40, 0, 0.5 * Math.PI);
  96. ctx.stroke();
  97.  
  98. ctx.fillStyle = "black";
  99. ctx.fillText("Zadanie 5", 10,950);
  100.  
  101. ctx.beginPath();
  102. ctx.arc(95, 1000, 40, 0, 2 * Math.PI);
  103. ctx.stroke();
  104.  
  105. ctx.beginPath();
  106. ctx.arc(95+100, 1000, 40, 0, 2 * Math.PI);
  107. ctx.stroke();
  108.  
  109. ctx.beginPath();
  110. ctx.arc(95+200, 1000, 40, 0, 2 * Math.PI);
  111. ctx.stroke();
  112.  
  113. ctx.beginPath();
  114. ctx.arc(95+50, 1000+40, 40, 0, 2 * Math.PI);
  115. ctx.stroke();
  116.  
  117. ctx.beginPath();
  118. ctx.arc(95+150, 1000+40, 40, 0, 2 * Math.PI);
  119. ctx.stroke();
  120.  
  121. </script>
  122.  
  123. </body>
  124. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement