Advertisement
apexsquirt

find diameter of a circle with a portion smaller than a ¼

Nov 10th, 2019
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.96 KB | None | 0 0
  1. <script>
  2.     function imgSize(){
  3.         var x = document.getElementById("INPUT");
  4.         var myImg = document.querySelector("#sky");
  5.         myImg.src = x.value;
  6.         var realWidth = myImg.naturalWidth;
  7.         var realHeight = myImg.naturalHeight;
  8.         var newHeight = myImg.height;
  9.         var newWidth = myImg.width;
  10.         var bruh1 = document.querySelector("#ptn1");
  11.         var bruh2 = document.querySelector("#ptn2");
  12.         bruh1.height = newHeight;
  13.         bruh2.height = newHeight;
  14.         bruh1.width = newWidth;
  15.         bruh2.width = newWidth;
  16.         var x = document.getElementById("p");
  17.         x.innerHTML = "Scale factor (real size / scaled size) : " + realWidth/newWidth;
  18.     }
  19. </script>
  20. <img src="" id="sky" height="50%" style="position: absolute; left: 25%; top: 25%">
  21. <img src="https://i.ibb.co/0s8R9C3/vert.png" id="ptn1" style="position: absolute; left: 25%; top: 25%">
  22. <img src="https://i.ibb.co/k20rXhM/cyan.png" id="ptn2" style="position: absolute; left: 25%; top: 25%; transform: rotate(90deg)">
  23. <font size="+2">
  24. <p>Diameter&nbsp;[&nbsp;<b>O</b>&nbsp;]&nbsp;=&nbsp;Length&nbsp;<sub><span style="color: rgb(0,255,127)"><b>&ndash;</b></span></sub>&nbsp;[&nbsp;<span style="color: rgb(0,255,127)"><b>+</b></span>&nbsp;]&nbsp;&sup2;&nbsp;/&nbsp;[&nbsp;4&nbsp;&times;&nbsp;Length&nbsp;<sub><span style="color: rgb(0,255,255)"><b>&ndash;</b></span></sub>&nbsp;[&nbsp;<b>(</b><span style="color: rgb(0,255,255)"><b>&ndash;</b></span><span style="color: rgb(0,255,127)"><b>|</b></span>&nbsp;]&nbsp;]&nbsp;+&nbsp;Length&nbsp;<sub><span style="color: rgb(0,255,255)"><b>&ndash;</b></span></sub>&nbsp;[&nbsp;<b>(</b><span style="color: rgb(0,255,255)"><b>&ndash;</b></span><span style="color: rgb(0,255,127)"><b>|</b></span>&nbsp;]</p>
  25. <input type="text" id="INPUT" value="https://i.ibb.co/LSkQDd6/Sans-titre.png">
  26. <button type="button" onclick="imgSize();">Set image</button>
  27. <button type="button" onclick="imgSize();">Adjust</button>
  28. <p id="p"></p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement