SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let canvas = document.getElementById("canvas");
  2. let ctx = canvas.getContext("2d");
  3. function create()
  4. {
  5.    
  6. ctx.clearRect(0,0,canvas.width,canvas.height)
  7.    
  8. let a1 = document.getElementById("a1").value;
  9. let a2 = document.getElementById("a2").value;
  10. let a3 = document.getElementById("a5").value;
  11. let a4 = document.getElementById("a4").value;
  12. let a5 = document.getElementById("a5").value; ///x
  13. let a6 = document.getElementById("a6").value; ///y
  14.    
  15. let mid = canvas.width/2;
  16. ctx.strokeRect(mid-50,mid-50,100,100);
  17.  
  18.  
  19.  
  20.    
  21.    
  22.    
  23. }
  24.  
  25. <!DOCTYPE html>
  26. <html lang="en">
  27. <head>
  28.     <meta charset="UTF-8">
  29.     <title>Document</title>
  30. </head>
  31. <body>
  32.     <canvas id="canvas" width="500px" height="500px" style="border:1px solid black;"></canvas>
  33.     <br>
  34.     <input type="text" style="width:20px;" id="a1" value="1">
  35.     <input type="text" style="width:20px;" id="a2" value="2">
  36.     <input type="text" style="width:20px;" id="a5" value="3"><br/><br>
  37.     <input type="text" style="width:20px;" id="a3" value="1">
  38.     <input type="text" style="width:20px;" id="a4" value="2">
  39.     <input type="text" style="width:20px;" id="a6" value="3"><br/><br>
  40.     <input type="button" value="Create!" onclick="create()">
  41.    
  42.     <script src="script.js"></script>
  43. </body>
  44. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top