Browse Source

3.141592653589

master
quegzacov 2 years ago
parent
commit
61d09d7a39
  1. 1
      index.php
  2. 8
      script.js

1
index.php

@ -16,7 +16,6 @@ var_dump($res);
?>
</code>
<svg id="roulette" width=800 height=800></svg>
<script type="text/javascript">
draw_roulette(2, 200, 200);
</script>

8
script.js

@ -1,13 +1,17 @@
function draw_roulette(nb_person, x, y){
let chart = document.getElementById("roulette")
let angle = 0;
for (let i=0; i < 1; i++){
let coo_arr = new Array(250 - 50 * Math.cos(2 * Math.PI / nb_person), 200 - 50 * Math.sin(2 * Math.PI / nb_person));
let svg = document.createElement('svg');
svg.setAttribute("width", 800);
svg.setAttribute('height', 800);
let new_path = document.createElement("path");
new_path.setAttribute('fill', 'green');
new_path.setAttribute('d', "M 200 200 A 50 50 0 0 1 " + coo_arr[0] + " " + coo_arr[1] + " L 250 200 Z");
chart.appendChild(new_path);
svg.appendChild(new_path);
document.getElementsByTag('body')[0].appendChild(svg);
console.log(svg)
console.log(new_path.getAttribute('d'));
}
};

Loading…
Cancel
Save