From a4bb7570a5ba91122c464a586efc5a897bef015b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 24 Mar 2017 22:10:04 +0100 Subject: dither blocks in their own file --- index.html | 1 + js/dither.js | 15 +++++++++++++++ js/ui/palette.js | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 js/dither.js diff --git a/index.html b/index.html index a7d3e1e..074080f 100644 --- a/index.html +++ b/index.html @@ -116,6 +116,7 @@ + diff --git a/js/dither.js b/js/dither.js new file mode 100644 index 0000000..37baf01 --- /dev/null +++ b/js/dither.js @@ -0,0 +1,15 @@ +var dither = { + aa: '▓▒░ ', + a: '▓', + b: '▒', + c: '░', + d: ' ', + p: function(n){ + if (0 <= 0 && n < 1) { + return block.aa[Math.floor(n * 4)] + } + else { + return block.aa[Math.floor(n % 4)] + } + } +} diff --git a/js/ui/palette.js b/js/ui/palette.js index 5931543..40da8b6 100644 --- a/js/ui/palette.js +++ b/js/ui/palette.js @@ -8,7 +8,7 @@ var palette = (function(){ var palette_index = localStorage.getItem("ascii.palette") || 1 var palette_list = [all_hue, all_inv_hue, mirc_color, mirc_color_reverse] var palette_fn = palette_list[palette_index] - palette.chars = " ▓▒░" + palette.chars = " " + dither.a + dither.b + dither.c palette.repaint = function(){ var xw = use_experimental_palette ? 5 : 2 -- cgit v1.2.3-70-g09d2