Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
96
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 = 'black';
  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 = 'black';
  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 = 'black';
  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 = 'black';
  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 = 'black';
  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 = 'black';
  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 = 'black';
  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 = 'black';
  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 = 'white'
  110. ctx.fill();
  111. ctx.stroke();
  112. }
  113. }
  114. for (var i=0;i<=7;i++)
  115. {
  116. if (i%2==0)
  117. {
  118. ctx.beginPath();
  119. ctx.arc((i * 40) + 20,60,15,0,2*Math.PI);
  120. ctx.fillStyle = 'white'
  121. ctx.fill();
  122. ctx.stroke();
  123. }
  124. }
  125. for (var i=0;i<=7;i++)
  126. {
  127. if (i%2!=0)
  128. {
  129. ctx.beginPath();
  130. ctx.arc((i * 40) + 20,100,15,0,2*Math.PI);
  131. ctx.fillStyle = 'white'
  132. ctx.fill();
  133. ctx.stroke();
  134. }
  135. }
  136. for (var i=0;i<=7;i++)
  137. {
  138. if (i%2==0)
  139. {
  140. ctx.beginPath();
  141. ctx.arc((i * 40) + 20,220,15,0,2*Math.PI);
  142. ctx.fillStyle = '#8B0000'
  143. ctx.fill();
  144. ctx.stroke();
  145. }
  146. }
  147. for (var i=0;i<=7;i++)
  148. {
  149. if (i%2!=0)
  150. {
  151. ctx.beginPath();
  152. ctx.arc((i * 40) + 20,260,15,0,2*Math.PI);
  153. ctx.fillStyle = '#8B0000'
  154. ctx.fill();
  155. ctx.stroke();
  156. }
  157. }
  158. for (var i=0;i<=7;i++)
  159. {
  160. if (i%2==0)
  161. {
  162. ctx.beginPath();
  163. ctx.arc((i * 40) + 20,300,15,0,2*Math.PI);
  164. ctx.fillStyle = '#8B0000'
  165. ctx.fill();
  166. ctx.stroke();
  167. }
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement