Advertisement
Denissdfsafsa

Untitled

Jan 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. var elem=document.getElementById("myCanvas");
  2. var ctx=elem.getContext("2d");
  3. ctx.fillStyle = '#2E64FE';
  4. ctx.strokeStyle = '#0B0B61';
  5. ctx.lineWidth = 0.5;
  6. for (var i=0;i<=7;i++)
  7. {
  8. if (i%2==0)
  9. {
  10. ctx.fillStyle = 'white';
  11. } else
  12. {
  13. ctx.fillStyle = 'green';
  14. }
  15. ctx.fillRect(i*40,0,40,40);
  16. ctx.strokeRect(i*40,0,40,40);
  17. }
  18. for (var i=0;i<=7;i++)
  19. {
  20. if (i%2==0)
  21. {
  22. ctx.fillStyle = 'green';
  23. } else
  24. {
  25. ctx.fillStyle = 'white';
  26. }
  27. ctx.fillRect(i*40,40,40,40);
  28. ctx.strokeRect(i*40,40,40,40);
  29. }
  30. for (var i=0;i<=7;i++)
  31. {
  32. if (i%2==0)
  33. {
  34. ctx.fillStyle = 'white';
  35. } else
  36. {
  37. ctx.fillStyle = 'green';
  38. }
  39. ctx.fillRect(i*40,80,40,40);
  40. ctx.strokeRect(i*40,80,40,40);
  41. }
  42. for (var i=0;i<=7;i++)
  43. {
  44. if (i%2==0)
  45. {
  46. ctx.fillStyle = 'green';
  47. } else
  48. {
  49. ctx.fillStyle = 'white';
  50. }
  51. ctx.fillRect(i*40,120,40,40);
  52. ctx.strokeRect(i*40,120,40,40);
  53. }
  54. for (var i=0;i<=7;i++)
  55. {
  56. if (i%2==0)
  57. {
  58. ctx.fillStyle = 'white';
  59. } else
  60. {
  61. ctx.fillStyle = 'green';
  62. }
  63. ctx.fillRect(i*40,160,40,40);
  64. ctx.strokeRect(i*40,160,40,40);
  65. }
  66. for (var i=0;i<=7;i++)
  67. {
  68. if (i%2==0)
  69. {
  70. ctx.fillStyle = 'green';
  71. } else
  72. {
  73. ctx.fillStyle = 'white';
  74. }
  75. ctx.fillRect(i*40,200, 40,40);
  76. ctx.strokeRect(i*40,200,40,40);
  77. }
  78. for (var i=0;i<=7;i++)
  79. {
  80. if (i%2==0)
  81. {
  82. ctx.fillStyle = 'white';
  83. } else
  84. {
  85. ctx.fillStyle = 'green';
  86. }
  87. ctx.fillRect(i*40,240,40,40);
  88. ctx.strokeRect(i*40,240,40,40);
  89. }
  90. for (var i=0;i<=7;i++)
  91. {
  92. if (i%2==0)
  93. {
  94. ctx.fillStyle = 'green';
  95. } else
  96. {
  97. ctx.fillStyle = 'white';
  98. }
  99. ctx.fillRect(i*40,280,40,40);
  100. ctx.strokeRect(i*40,280,40,40);
  101. }
  102.  
  103. for (var i=0;i<=7;i++)
  104. {
  105. if (i%2!=0)
  106. {
  107. ctx.beginPath();
  108. ctx.arc((i * 40) + 20,20,15,0,2*Math.PI);
  109. ctx.fillStyle = 'purple'
  110. ctx.fill();
  111. ctx.stroke();
  112. }
  113.  
  114. }
  115. for (var i=0;i<=7;i++)
  116. {
  117. if (i%2==0)
  118. {
  119. ctx.beginPath();
  120. ctx.arc((i * 40) + 20,60,15,0,2*Math.PI);
  121. ctx.fillStyle = 'purple'
  122. ctx.fill();
  123. ctx.stroke();
  124. }
  125. }
  126. for (var i=0;i<=7;i++)
  127. {
  128. if (i%2!=0)
  129. {
  130. ctx.beginPath();
  131. ctx.arc((i * 40) + 20,100,15,0,2*Math.PI);
  132. ctx.fillStyle = 'purple'
  133. ctx.fill();
  134. ctx.stroke();
  135. }
  136. }
  137. for (var i=0;i<=7;i++)
  138. {
  139. if (i%2==0)
  140. {
  141. ctx.beginPath();
  142. ctx.arc((i * 40) + 20,220,15,0,2*Math.PI);
  143. ctx.fillStyle = 'blue'
  144. ctx.fill();
  145. ctx.stroke();
  146. }
  147. }
  148. for (var i=0;i<=7;i++)
  149. {
  150. if (i%2!=0)
  151. {
  152. ctx.beginPath();
  153. ctx.arc((i * 40) + 20,260,15,0,2*Math.PI);
  154. ctx.fillStyle = 'blue'
  155. ctx.fill();
  156. ctx.stroke();
  157. }
  158. }
  159. for (var i=0;i<=7;i++)
  160. {
  161. if (i%2==0)
  162. {
  163. ctx.beginPath();
  164. ctx.arc((i * 40) + 20,300,15,0,2*Math.PI);
  165. ctx.fillStyle = 'blue'
  166. ctx.fill();
  167. ctx.stroke();
  168. }
  169. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement