Skip to content

Commit 2316095

Browse files
committed
move old entry to legacy directory
1 parent 4998396 commit 2316095

File tree

8 files changed

+53
-51
lines changed

8 files changed

+53
-51
lines changed

internal/animate/interpolate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import {Shape} from "../types";
22
import {split, splitLine, mod} from "../util";
33

4+
// TODO percentage > 1
5+
// TODO interpolation function (ex. easing)
6+
47
const interpolateAngle = (percentage: number, a: number, b: number): number => {
58
const tau = Math.PI * 2;
69
let aNorm = mod(a, tau);

testing/animate.html renamed to internal/animate/testing/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</head>
1919

2020
<body>
21-
<script src="./animate.ts"></script>
21+
<script src="./script.ts"></script>
2222
</body>
2323

2424
</html>

testing/animate.ts renamed to internal/animate/testing/script.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import blobs from "..";
1+
import blobs from "../../../legacy/blobs";
22

3-
import {interpolateBetweenLoop} from "../internal/animate/interpolate";
4-
import {divideShape, prepShapes} from "../internal/animate/prepare";
5-
import {Coord, Point, Shape} from "../internal/types";
6-
import {length, insertAt, insertCount, rad, mod} from "../internal/util";
7-
import {clear, drawInfo, drawShape} from "../internal/render/canvas";
3+
import {interpolateBetweenLoop} from "../interpolate";
4+
import {divideShape, prepShapes} from "../prepare";
5+
import {Coord, Point, Shape} from "../../types";
6+
import {length, insertAt, insertCount, rad, mod} from "../../util";
7+
import {clear, drawInfo, drawShape} from "../../render/canvas";
88

99
const animationSpeed = 2;
1010
const animationStart = 0.3;

testing/blobs.test.ts renamed to legacy/blobs.test.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import blobs, {BlobOptions} from "..";
1+
import blobs, {BlobOptions} from "./blobs";
22

33
const genMinimalOptions = (): BlobOptions => ({
44
size: 1000 * Math.random(),
@@ -80,3 +80,39 @@ describe("editable", () => {
8080
expect(modified).not.toBe(initial);
8181
});
8282
});
83+
84+
// Sanity checks to ensure the output remains consistent
85+
// across changes to the source.
86+
const testCases: Record<string, BlobOptions> = {
87+
fill: {
88+
size: 109,
89+
complexity: 0.1,
90+
contrast: 0.331,
91+
color: "red",
92+
seed: "fill",
93+
},
94+
stroke: {
95+
size: 226,
96+
complexity: 0.91,
97+
contrast: 0.6,
98+
stroke: {
99+
color: "#ff00bb",
100+
width: 3.8,
101+
},
102+
seed: "stroke",
103+
},
104+
guides: {
105+
size: 781,
106+
complexity: 1,
107+
contrast: 0.331,
108+
color: "yellow",
109+
guides: true,
110+
seed: "guides",
111+
},
112+
};
113+
114+
for (const testCase of Object.keys(testCases)) {
115+
test(testCase, () => {
116+
expect(blobs(testCases[testCase])).toMatchSnapshot();
117+
});
118+
}

index.ts renamed to legacy/blobs.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// https://www.blobmaker.app/
22

3-
import {rand} from "./internal/rand";
4-
import {Shape} from "./internal/types";
5-
import {smooth, rad} from "./internal/util";
6-
import {renderEditable} from "./internal/render/svg";
7-
import {XmlElement} from "./editable";
3+
import {rand} from "../internal/rand";
4+
import {Shape} from "../internal/types";
5+
import {smooth, rad} from "../internal/util";
6+
import {renderEditable} from "../internal/render/svg";
7+
import {XmlElement} from "../editable";
88

99
export interface PathOptions {
1010
// Bounding box dimensions.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "npm run clean && rollup -c rollup.config.ts",
1313
"clean": "trash '**/*.js' '**/*.js.map' '**/*.d.ts' '!**/node_modules/**/*'",
1414
"fmt": "prettier --list-different --write --ignore-path .gitignore '**/*.{js,ts}'",
15-
"anim": "parcel testing/animate.html --open",
15+
"anim": "parcel internal/animate/testing/index.html --open",
1616
"test": "jest"
1717
},
1818
"devDependencies": {

testing/snapshots.test.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)