From 77970dbcd1c2693c85065fef60e2b9fba938b990 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Sun, 6 Apr 2025 17:12:51 +1000 Subject: [PATCH] Cell size is now randomised --- src/index.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/index.md b/src/index.md index a9d97ae..1dd835c 100644 --- a/src/index.md +++ b/src/index.md @@ -28,11 +28,8 @@ const MAG = 2; const WIDTH = 200; const HEIGHT = 200; -const cell = view(Inputs.range([10,60], {value: 10, label: "Cell size"})); -//const width = view(Inputs.range([1,40], {value: 20, label: "Width"})); -//const height = view(Inputs.range([1,40], {value: 20, label: "Height"})); - -//const aspect = view(Inputs.select()) +const cell_input = Inputs.range([5,60], {value: 10, label: "cell size"}); +const cell = view(cell_input); ``` @@ -40,11 +37,13 @@ const cell = view(Inputs.range([10,60], {value: 10, label: "Cell size"})); ```js -const bg_input = Inputs.color({label: "background", value: d3.color("yellow").formatHex()}); +const bg_input = Inputs.color({ + label: "background", value: d3.color("white").formatHex() +}); const bg = view(bg_input); -const ctrl1 = new DotControls(d3.color("red").formatHex(), RADIUS_OPTS); -const ctrl2 = new DotControls(d3.color("blue").formatHex(), RADIUS_OPTS); +const ctrl1 = new DotControls(d3.color("white").formatHex(), RADIUS_OPTS); +const ctrl2 = new DotControls(d3.color("white").formatHex(), RADIUS_OPTS); const fg1 = view(ctrl1.fg); @@ -96,6 +95,8 @@ ctrl1.null_grid(); ctrl2.null_grid(); palette_input.value = PALETTES.get(rpalette); palette_input.dispatchEvent(new Event("input")); +cell_input.value = 5 + random.float() * random.float() * 55; +cell_input.dispatchEvent(new Event("input")); ctrl1.random_grid(); ctrl2.random_grid();