From 573af4a5cfbbf54c4c7c49539463f667aa89e767 Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Wed, 12 Aug 2015 12:10:37 +0200 Subject: [PATCH] Update contour.html --- examples/contour.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/contour.html b/examples/contour.html index ab1d883..b5d2e21 100644 --- a/examples/contour.html +++ b/examples/contour.html @@ -9,16 +9,16 @@ var canvas = document.getElementById("sample"); var ctx = canvas.getContext("2d"); - // for (var y = 0; y < grid.length; y++){ - // for (var x = 0; x < grid[0].length; x++){ - // ctx.beginPath(); - // ctx.arc(20 + x*20, 20 + y*20, 3, 0, 2 * Math.PI, false); - // var value = grid[y][x]; - // ctx.fillStyle = "rgb("+0+", "+value * 50+", "+value * 50+")"; - // if(value === 0) ctx.fillStyle = "red"; - // ctx.fill(); - // } - // } + for (var y = 0; y < grid.length; y++){ + for (var x = 0; x < grid[0].length; x++){ + ctx.beginPath(); + ctx.arc(20 + x*20, 20 + y*20, 3, 0, 2 * Math.PI, false); + var value = grid[y][x]; + ctx.fillStyle = "rgb("+0+", "+value * 50+", "+value * 50+")"; + if(value === 0) ctx.fillStyle = "red"; + ctx.fill(); + } + } var cellsX = grid[0].length-1; var cellsY = grid.length-1; @@ -81,4 +81,4 @@ return Math.max(Math.min(1 + (-0.5) * (contourValue - valueA) / (valueB - valueA), 0.8), 0.2); } - \ No newline at end of file +