Compare commits
No commits in common. "77970dbcd1c2693c85065fef60e2b9fba938b990" and "6c42510a7dc39dcbd107039d97a8cfed9bff2ad3" have entirely different histories.
77970dbcd1
...
6c42510a7d
@ -99,7 +99,7 @@ class DotMaker {
|
|||||||
|
|
||||||
// case "hyper-out":
|
// case "hyper-out":
|
||||||
// return 2 * maxr * Math.abs(d.x - this.cx) (d.y - this.cy)) / this.width;
|
// return 2 * maxr * Math.abs(d.x - this.cx) (d.y - this.cy)) / this.width;
|
||||||
// case "hyper-in":
|
// case "hyoer-in":
|
||||||
// return 2 * maxr * (0.5 * this.width - distance((d.x - this.cx), (d.y - this.cy))) / this.width;
|
// return 2 * maxr * (0.5 * this.width - distance((d.x - this.cx), (d.y - this.cy))) / this.width;
|
||||||
|
|
||||||
case "noise":
|
case "noise":
|
||||||
|
28
src/index.md
28
src/index.md
@ -24,12 +24,15 @@ import random from "npm:random";
|
|||||||
|
|
||||||
import * as resvg from 'npm:@resvg/resvg-wasm';
|
import * as resvg from 'npm:@resvg/resvg-wasm';
|
||||||
|
|
||||||
|
const CELL = 10;
|
||||||
const MAG = 2;
|
const MAG = 2;
|
||||||
const WIDTH = 200;
|
const WIDTH = 20;
|
||||||
const HEIGHT = 200;
|
const HEIGHT = WIDTH;
|
||||||
|
|
||||||
const cell_input = Inputs.range([5,60], {value: 10, label: "cell size"});
|
const cell = view(Inputs.range([1,20], {value: 10, step:1, label: "Cell size"}));
|
||||||
const cell = view(cell_input);
|
const mag = view(Inputs.range([1,5], {value: 2, step:1, label: "Magnificaton"}));
|
||||||
|
const width = view(Inputs.range([1,40], {value: 20, step:1, label: "Width"}));
|
||||||
|
const height = view(Inputs.range([1,40], {value: 20, step:1, label: "Height"}));
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -37,13 +40,11 @@ const cell = view(cell_input);
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
const bg_input = Inputs.color({
|
const bg_input = Inputs.color({label: "background", value: d3.color("yellow").formatHex()});
|
||||||
label: "background", value: d3.color("white").formatHex()
|
|
||||||
});
|
|
||||||
const bg = view(bg_input);
|
const bg = view(bg_input);
|
||||||
|
|
||||||
const ctrl1 = new DotControls(d3.color("white").formatHex(), RADIUS_OPTS);
|
const ctrl1 = new DotControls(d3.color("red").formatHex(), RADIUS_OPTS);
|
||||||
const ctrl2 = new DotControls(d3.color("white").formatHex(), RADIUS_OPTS);
|
const ctrl2 = new DotControls(d3.color("blue").formatHex(), RADIUS_OPTS);
|
||||||
|
|
||||||
|
|
||||||
const fg1 = view(ctrl1.fg);
|
const fg1 = view(ctrl1.fg);
|
||||||
@ -95,8 +96,6 @@ 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();
|
||||||
|
|
||||||
@ -128,9 +127,6 @@ if( palette_fn ) {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
const width = WIDTH / cell;
|
|
||||||
const height = HEIGHT / cell;
|
|
||||||
|
|
||||||
const dm = new DotMaker(width, height);
|
const dm = new DotMaker(width, height);
|
||||||
|
|
||||||
const dots1 = dm.dots(1 / m1, n1, false);
|
const dots1 = dm.dots(1 / m1, n1, false);
|
||||||
@ -144,8 +140,8 @@ const dots2 = dm.dots(1 / m2, n2, false);
|
|||||||
|
|
||||||
|
|
||||||
const svg = d3.create("svg")
|
const svg = d3.create("svg")
|
||||||
.attr("width", width * cell * MAG)
|
.attr("width", width * cell * mag)
|
||||||
.attr("height", height * cell * MAG)
|
.attr("height", height * cell * mag)
|
||||||
.attr("viewBox", [ 0, 0, width, height ]);
|
.attr("viewBox", [ 0, 0, width, height ]);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user