Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Flower</title>
  6. </head>
  7. <body>
  8.  
  9. <canvas onmouseover="colorin()" onmouseout="colorout()" id="Flower" width="300" height="600" style="border:5px solid"></canvas>
  10.  
  11. <script>
  12.  
  13. var flower = document.getElementById('Flower');
  14.  
  15. var flow1 = flower.getContext('2d');
  16. var flow2 = flower.getContext('2d');
  17. var flow3 = flower.getContext('2d');
  18. var flow4 = flower.getContext('2d');
  19. var flow5 = flower.getContext('2d');
  20. var lin = flower.getContext('2d');
  21.  
  22. lin.beginPath();
  23. lin.moveTo(150, 150);
  24. lin.lineTo(150, 600);
  25. lin.lineWidth = 15;
  26. lin.stroke();
  27.  
  28. flow1.beginPath();
  29. flow1.arc(150, 100, 70, 0, 2 * Math.PI, false);
  30. flow1.fillStyle = 'green';
  31. flow1.fill();
  32. flow1.lineWidth = 3;
  33. flow1.strokeStyle = '#003300';
  34. flow1.stroke();
  35.  
  36. flow2.beginPath();
  37. flow2.arc(100, 150, 70, 0, 2 * Math.PI, false);
  38. flow2.fillStyle = 'green';
  39. flow2.fill();
  40. flow2.lineWidth = 3;
  41. flow2.strokeStyle = '#003300';
  42. flow2.stroke();
  43.  
  44. flow3.beginPath();
  45. flow3.arc(200, 150, 70, 0, 2 * Math.PI, false);
  46. flow3.fillStyle = 'green';
  47. flow3.fill();
  48. flow3.lineWidth = 3;
  49. flow3.strokeStyle = '#003300';
  50. flow3.stroke();
  51.  
  52. flow4.beginPath();
  53. flow4.arc(150, 200, 70, 0, 2 * Math.PI, false);
  54. flow4.fillStyle = 'green';
  55. flow4.fill();
  56. flow4.strokeStyle = '#003300';
  57. flow4.stroke();
  58.  
  59. flow5.beginPath();
  60. flow5.arc(150, 150, 50, 0, 2 * Math.PI, false);
  61. flow5.fillStyle = 'yellow';
  62. flow5.fill();
  63. flow5.lineWidth = 1;
  64. flow5.strokeStyle = '#003300';
  65. flow5.stroke();
  66.  
  67. function colorin(){
  68.  
  69. flow5.fillStyle = 'yellow';
  70. flow5.fill();
  71.  
  72. }
  73.  
  74. function colorout(){
  75.  
  76. flow5.fillStyle = 'red';
  77. flow5.fill();
  78.  
  79. }
  80.  
  81. </script>
  82.  
  83. </script>
  84. </body>
  85.  
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement