quegzacov
2 years ago
1 changed files with 6 additions and 3 deletions
@ -1,15 +1,18 @@ |
|||||
|
|
||||
function draw_roulette(nb_person, x, y){ |
function draw_roulette(nb_person, x, y){ |
||||
let chart = document.getElementById("roulette") |
let chart = document.getElementById("roulette") |
||||
|
let starting_coo= new Array(x, y); |
||||
let angle = 0; |
let angle = 0; |
||||
for (let i=0; i < 1; i++){ |
for (let i=0; i < nb_person; 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 coo_arr = new Array(250 - 50 * Math.cos(2 * Math.PI / nb_person) * (i+1), 200 - 50 * Math.sin(2 * Math.PI / nb_person) * (i+1)); |
||||
let new_path = document.createElement("path"); |
let new_path = document.createElement("path"); |
||||
new_path.setAttribute('fill', 'green'); |
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"); |
new_path.setAttribute('d', "M " + starting_coo[0] + " " + starting_coo[1] + " A 50 50 0 0 1 " + coo_arr[0] + " " + coo_arr[1] + " L 250 200 Z"); |
||||
chart.appendChild(new_path); |
chart.appendChild(new_path); |
||||
chart.innerHTML += ' '; |
chart.innerHTML += ' '; |
||||
console.log(new_path.getAttribute('d')); |
console.log(new_path.getAttribute('d')); |
||||
|
|
||||
|
starting_coo = coo_arr |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
|
Loading…
Reference in new issue