Cell size is now randomised

This commit is contained in:
Mike Lynch 2025-04-06 17:12:51 +10:00
parent 46fd00600e
commit 77970dbcd1

View File

@ -28,11 +28,8 @@ const MAG = 2;
const WIDTH = 200; const WIDTH = 200;
const HEIGHT = 200; const HEIGHT = 200;
const cell = view(Inputs.range([10,60], {value: 10, label: "Cell size"})); const cell_input = Inputs.range([5,60], {value: 10, label: "cell size"});
//const width = view(Inputs.range([1,40], {value: 20, label: "Width"})); const cell = view(cell_input);
//const height = view(Inputs.range([1,40], {value: 20, label: "Height"}));
//const aspect = view(Inputs.select())
``` ```
@ -40,11 +37,13 @@ const cell = view(Inputs.range([10,60], {value: 10, label: "Cell size"}));
```js ```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 bg = view(bg_input);
const ctrl1 = new DotControls(d3.color("red").formatHex(), RADIUS_OPTS); const ctrl1 = new DotControls(d3.color("white").formatHex(), RADIUS_OPTS);
const ctrl2 = new DotControls(d3.color("blue").formatHex(), RADIUS_OPTS); const ctrl2 = new DotControls(d3.color("white").formatHex(), RADIUS_OPTS);
const fg1 = view(ctrl1.fg); const fg1 = view(ctrl1.fg);
@ -96,6 +95,8 @@ ctrl1.null_grid();
ctrl2.null_grid(); ctrl2.null_grid();
palette_input.value = PALETTES.get(rpalette); palette_input.value = PALETTES.get(rpalette);
palette_input.dispatchEvent(new Event("input")); palette_input.dispatchEvent(new Event("input"));
cell_input.value = 5 + random.float() * random.float() * 55;
cell_input.dispatchEvent(new Event("input"));
ctrl1.random_grid(); ctrl1.random_grid();
ctrl2.random_grid(); ctrl2.random_grid();