Advertisement
Guest User

Untitled

a guest
May 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="pl-PL">
  3.  
  4. <head>
  5. <title>Index</title>
  6. <meta charset="utf-8">
  7. <style>
  8. .eszkere {
  9. text-align: center;
  10. }
  11.  
  12. .eszkere h1, h2 {
  13. font-family: Helvetica;
  14. }
  15.  
  16. .eszkere h1 {
  17. font-size: 45px;
  18. }
  19.  
  20. .eszkere h1:first-letter, h2::first-letter {
  21. color: red;
  22. }
  23.  
  24. #rysowanie {
  25. border: 1px solid black;
  26. position: absolute;
  27. margin: 0 auto;
  28. bottom: 25%;
  29. right: 25%;
  30.  
  31. }
  32. </style>
  33. </head>
  34.  
  35. <body>
  36. <div class="eszkere">
  37. <br>
  38. <h1>Canvas</h1>
  39. <h2>Rysowanie w JavaScript</h2>
  40. <hr>
  41. <canvas id="rysowanie" width="1000" height="500"></canvas>
  42. </div>
  43.  
  44. <script id="kwadrat">
  45. var c = document.getElementById("rysowanie");
  46. var ctx = c.getContext("2d");
  47. ctx.beginPath();
  48. ctx.fillStyle = "gray";
  49. ctx.fillRect(700, 20, 150, 150);
  50. ctx.fill();
  51. ctx.strokeStyle = "red";
  52. ctx.lineWidth = 5;
  53. ctx.strokeRect(700, 20, 150, 150);
  54. ctx.fillStyle = "black";
  55. ctx.font = "100px Arial";
  56. ctx.fillText("I", 743, 125);
  57. </script>
  58.  
  59. <script id="kolo">
  60. var c = document.getElementById("rysowanie");
  61. var ctx = c.getContext("2d");
  62. ctx.beginPath();
  63. ctx.arc(90,90,80,0,10*Math.PI);
  64. ctx.strokeStyle="red";
  65. ctx.lineWidth = 10;
  66. ctx.stroke();
  67. ctx.fillStyle= "gray";
  68. ctx.fill();
  69. ctx.fillStyle = "black";
  70. ctx.font = "100px Arial";
  71. ctx.fillText("F", 60, 120);
  72.  
  73. </script>
  74.  
  75. <script id="prostokat">
  76. var c = document.getElementById("rysowanie");
  77. var ctx = c.getContext("2d");
  78. ctx.beginPath();
  79. ctx.rotate(Math.PI / 0);
  80. ctx.rect(300, 20, 250, 150);
  81. ctx.fillStyle = "gray";
  82. ctx.fill();
  83. ctx.lineWidth = 5;
  84. ctx.strokeStyle = "red";
  85. ctx.stroke();
  86. ctx.fillStyle = "black";
  87. ctx.font = "100px Arial";
  88. ctx.fillText("B", 390, 130);
  89.  
  90. </script>
  91. </body>
  92. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement