From e163e9daf9218101105e76a20ffb1cee0a14e10c Mon Sep 17 00:00:00 2001 From: quegzacov Date: Sat, 24 Dec 2022 18:08:53 +0100 Subject: [PATCH] 3.14159265 --- index.php | 2 +- script.js | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index b2a0217..dcb4fce 100755 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ Roulette à eau - + diff --git a/script.js b/script.js index cdc426b..7c279e2 100755 --- a/script.js +++ b/script.js @@ -1,8 +1,8 @@ function draw_roulette(ctx, w, h, datalist){ var radius = h / 2 - 5; var center = new Array(w / 2, h / 2); - var total = 0; - var sum = datalist.reduce((acc, value) => acc + value, total); + var init = 0; + var total = datalist.reduce((acc, value) => acc + value, init); var lastend = 0; var offset = Math.PI / 2; for (i=0; i < datalist.length; i++){ @@ -18,10 +18,4 @@ function draw_roulette(ctx, w, h, datalist){ ctx.closePath(); lastend += arcsector; } -} - -var datalist= new Array(35, 25, 20, 12, 7, 1); -var colist = new Array('blue', 'red', 'green', 'orange', 'gray', 'yellow'); -var canvas = document.getElementById("roulette"); -var rendu = canvas.getContext('2d'); -draw_roulette(rendu, canvas.width, canvas.height, datalist); +}