BrU32

JS Customizeable Graph

Oct 17th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <html>
  2. <body onload="draw();">
  3. <canvas id="canvas" width="2000" height="2000" style="1px background:black"></canvas>
  4. </body>
  5. </html>
  6. <script>
  7. function draw() {
  8. var ee=prompt('Enter Level:');
  9. ctx=document.getElementById('canvas').getContext('2d');
  10. var img = new Image();
  11. img.onload = function(){
  12. ctx.scale(2,2);
  13. ctx.drawImage(img,0,0);
  14. ctx.beginPath();
  15. ctx.strokeStyle='darkred';
  16. ctx.moveTo(ee,115);
  17. ctx.lineTo(115,15);
  18. ctx.stroke();
  19. };
  20. img.src='https://mdn.mozillademos.org/files/5395/backdrop.png';
  21. }
  22. </script>
Add Comment
Please, Sign In to add comment