Compare commits
4 Commits
0fbe462779
...
e6f977b29e
Author | SHA1 | Date | |
---|---|---|---|
e6f977b29e | |||
|
0f066251ca | ||
|
7a1db41c18 | ||
|
3b50b39569 |
@ -73,7 +73,7 @@ export async function download_as_png (svg) {
|
|||||||
const opts = {
|
const opts = {
|
||||||
fitTo: {
|
fitTo: {
|
||||||
mode: 'width', // If you need to change the size
|
mode: 'width', // If you need to change the size
|
||||||
value: 400,
|
value: 1200,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const resvgJS = new resvg.Resvg(svgstr, opts)
|
const resvgJS = new resvg.Resvg(svgstr, opts)
|
||||||
|
21
src/index.md
21
src/index.md
@ -8,7 +8,7 @@ toc: false
|
|||||||
|
|
||||||
colourful generative patterns using [d3](https://d3js.org/) and [Observable Framework](https://observablehq.com/framework/)
|
colourful generative patterns using [d3](https://d3js.org/) and [Observable Framework](https://observablehq.com/framework/)
|
||||||
|
|
||||||
<p>v1.1.1 | by <a href="https://mikelynch.org">mike lynch</a> | <a href="https://aus.social/@mikelynch">@mikelynch@aus.social</a> | <a href="https://git.tilde.town/bombinans/poptimal">source</a></p>
|
<p>v1.1.2 | by <a href="https://mikelynch.org">mike lynch</a> | <a href="https://aus.social/@mikelynch">@mikelynch@aus.social</a> | <a href="https://git.tilde.town/bombinans/poptimal">source</a></p>
|
||||||
|
|
||||||
<div class="grid grid-cols-2">
|
<div class="grid grid-cols-2">
|
||||||
|
|
||||||
@ -118,8 +118,8 @@ if( palette_fn ) {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
const dots1 = dm.dots(1 / m1, n1, true);
|
const dots1 = dm.dots(1 / m1, n1, false);
|
||||||
const dots2 = dm.dots(1 / m2, n2, true);
|
const dots2 = dm.dots(1 / m2, n2, false);
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -134,6 +134,15 @@ const svg = d3.create("svg")
|
|||||||
.attr("viewBox", [ 0, 0, WIDTH, HEIGHT ]);
|
.attr("viewBox", [ 0, 0, WIDTH, HEIGHT ]);
|
||||||
|
|
||||||
|
|
||||||
|
svg.append("clipPath")
|
||||||
|
.attr("id", "clipRect")
|
||||||
|
.append("rect")
|
||||||
|
.attr("x", 0)
|
||||||
|
.attr("y", 0)
|
||||||
|
.attr("width", WIDTH)
|
||||||
|
.attr("height", HEIGHT);
|
||||||
|
|
||||||
|
|
||||||
// re transitions: they should only run when updating the palette and
|
// re transitions: they should only run when updating the palette and
|
||||||
// grid, not via the sliders
|
// grid, not via the sliders
|
||||||
|
|
||||||
@ -158,7 +167,8 @@ bg_g.selectAll("rect")
|
|||||||
|
|
||||||
|
|
||||||
const dots_g1 = svg.append("g")
|
const dots_g1 = svg.append("g")
|
||||||
.attr("id", "dots1");
|
.attr("id", "dots1")
|
||||||
|
.attr("clip-path", "url(#clipRect)");
|
||||||
|
|
||||||
dots_g1.selectAll("circle")
|
dots_g1.selectAll("circle")
|
||||||
.data(dots1)
|
.data(dots1)
|
||||||
@ -168,7 +178,8 @@ dots_g1.selectAll("circle")
|
|||||||
.attr("fill", fg1);
|
.attr("fill", fg1);
|
||||||
|
|
||||||
const dots_g2 = svg.append("g")
|
const dots_g2 = svg.append("g")
|
||||||
.attr("id", "dots2");
|
.attr("id", "dots2")
|
||||||
|
.attr("clip-path", "url(#clipRect)");
|
||||||
|
|
||||||
dots_g2.selectAll("circle")
|
dots_g2.selectAll("circle")
|
||||||
.data(dots2)
|
.data(dots2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user