Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Practice JavaScript by drawing</title>
  7. </head>
  8. <body>
  9. <canvas id="myCanvas" height="300" width="450" style="border: 1px solid black"></canvas>
  10. <script id="jsbin-javascript">
  11. var canvas = document.getElementById('myCanvas');
  12. var context = canvas.getContext('2d');
  13.  
  14. var cH = canvas.height;
  15. var cW = canvas.width;
  16.  
  17. context.beginPath();
  18. context.moveTo(0,150);
  19. context.lineTo(450,150);
  20. context.strokeStyle = 'red';
  21. context.stroke();
  22.  
  23. context.beginPath();
  24. context.moveTo(225,0);
  25. context.lineTo(225,350);
  26. context.strokeStyle = 'green';
  27. context.stroke();
  28. </script>
  29.  
  30.  
  31.  
  32. <script id="jsbin-source-javascript" type="text/javascript">var canvas = document.getElementById('myCanvas');
  33. var context = canvas.getContext('2d');
  34.  
  35. var cH = canvas.height;
  36. var cW = canvas.width;
  37.  
  38. context.beginPath();
  39. context.moveTo(0,150);
  40. context.lineTo(450,150);
  41. context.strokeStyle = 'red';
  42. context.stroke();
  43.  
  44. context.beginPath();
  45. context.moveTo(225,0);
  46. context.lineTo(225,350);
  47. context.strokeStyle = 'green';
  48. context.stroke();
  49.  
  50. </script></body>
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement