|
@ -2,6 +2,7 @@ |
|
|
function draw_roulette(x, y, r, names){ |
|
|
function draw_roulette(x, y, r, names){ |
|
|
let nb_person = names.length; |
|
|
let nb_person = names.length; |
|
|
let chart = document.getElementById("roulette").querySelector('g'); |
|
|
let chart = document.getElementById("roulette").querySelector('g'); |
|
|
|
|
|
chart.innerHTML = ''; |
|
|
let starting_coo = new Array(x, y + r); |
|
|
let starting_coo = new Array(x, y + r); |
|
|
let text_coo = new Array(starting_coo[0] + (r/2), starting_coo[1]); |
|
|
let text_coo = new Array(starting_coo[0] + (r/2), starting_coo[1]); |
|
|
let center = new Array(x + r, y + r); |
|
|
let center = new Array(x + r, y + r); |
|
@ -35,7 +36,7 @@ function draw_roulette(x, y, r, names){ |
|
|
function rotate(){ |
|
|
function rotate(){ |
|
|
nb_person = names.length; |
|
|
nb_person = names.length; |
|
|
let winner = Math.random() * nb_person; |
|
|
let winner = Math.random() * nb_person; |
|
|
let angle = Math.floor(Math.random()*15)*360 - winner * 360/nb_person; |
|
|
let angle = Math.floor(Math.random()* (15 - 5) + 5)*360 - winner * 360/nb_person; |
|
|
let result = new Promise((resolve, reject) => { |
|
|
let result = new Promise((resolve, reject) => { |
|
|
let i = 0; |
|
|
let i = 0; |
|
|
let add = 0; |
|
|
let add = 0; |
|
@ -67,3 +68,8 @@ function show_winner(winner){ |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function remove_person(id) { |
|
|
|
|
|
names.splice(id, 1); |
|
|
|
|
|
document.getElementById('list_person').removeChild(document.getElementById(id)); |
|
|
|
|
|
draw_roulette(200, 200, 200, names); |
|
|
|
|
|
} |