Skip to content

Commit d613ddb

Browse files
Publish v0.23.0
1 parent bfe897a commit d613ddb

22 files changed

+183
-154
lines changed

dist/adapter-editart.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var SUPPORTED_TYPES = ["choice", "range", "toggle", "weighted"];
88
var {
99
math: { clamp, round, fit, mix },
10-
prng: { sfc32 },
10+
prng: { defPRNG, sfc32 },
1111
utils: { isString, hashString }
1212
} = $genart;
1313
var EditArtAdapter = class {
@@ -164,17 +164,11 @@
164164
location.search = this._searchParams.toString();
165165
}
166166
initPRNG() {
167-
let seedStr = randomSeedEditArt;
167+
let seedStr = typeof randomSeedEditArt !== "undefined" ? randomSeedEditArt : $genart.id;
168168
for (let i = 0; i < MAX_PARAMS; i++) {
169169
seedStr += this._searchParams.get("m" + i) || "0.5";
170170
}
171-
const seed = hashString(seedStr);
172-
const reset = () => sfc32(seed);
173-
this._prng = {
174-
seed: seedStr,
175-
rnd: reset(),
176-
reset
177-
};
171+
this._prng = defPRNG(seedStr, hashString(seedStr), sfc32);
178172
}
179173
serializeParam(spec) {
180174
switch (spec.type) {

dist/adapter-editart.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/adapter-fxhash.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
event: "sync"
1919
};
2020
var {
21-
prng: { sfc32 },
21+
prng: { defPRNG, sfc32 },
2222
utils: { equiv, isString, hashString }
2323
} = $genart;
2424
var FxhashAdapter = class {
@@ -31,7 +31,6 @@
3131
constructor() {
3232
this._searchParams = new URLSearchParams(location.search);
3333
this._screen = this.screen;
34-
this.initPRNG();
3534
$genart.on("genart:state-change", ({ state }) => {
3635
if (state === "ready") $genart.start();
3736
});
@@ -90,7 +89,7 @@
9089
};
9190
}
9291
get prng() {
93-
return this._prng;
92+
return this._prng || (this._prng = defPRNG($fx.hash, hashString($fx.hash), sfc32));
9493
}
9594
configure(_) {
9695
}
@@ -240,15 +239,6 @@
240239
);
241240
location.search = this._searchParams.toString();
242241
}
243-
initPRNG() {
244-
const seed = hashString($fx.hash);
245-
const reset = () => sfc32(seed);
246-
this._prng = {
247-
seed: $fx.hash,
248-
rnd: reset(),
249-
reset
250-
};
251-
}
252242
adaptVectorParam(id, idx) {
253243
return {
254244
id,

dist/adapter-fxhash.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/adapter-layer.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@
1010
vector: "NUMBER",
1111
xy: "NUMBER"
1212
};
13-
var { equiv, isString } = $genart.utils;
13+
var {
14+
prng: { defPRNG, sfc32 },
15+
utils: { equiv, isString, parseUUID }
16+
} = $genart;
1417
var LayerAdapter = class {
1518
mode = "play";
19+
_prng;
1620
_params;
1721
_cache = {};
1822
_adaptations = {};
1923
constructor() {
20-
$layer.debug = true;
2124
$genart.on(
2225
"genart:state-change",
2326
({ state }) => state === "ready" && !$layer.controlled && $genart.start()
@@ -64,11 +67,7 @@
6467
};
6568
}
6669
get prng() {
67-
return {
68-
seed: $layer.uuid,
69-
rnd: $layer.prng,
70-
reset: () => $layer.prng
71-
};
70+
return this._prng || (this._prng = defPRNG($layer.uuid, parseUUID($layer.uuid), sfc32));
7271
}
7372
async updateParam(id, _) {
7473
let value;
@@ -145,7 +144,7 @@
145144
case "^[a-zA-Z ]+$":
146145
$dest.pattern = "ALPHABETICAL";
147146
break;
148-
case "^[a-zA-Z0-9-_ ]+$":
147+
case "^[a-zA-Z0-9_ ]+$":
149148
$dest.pattern = "ALPHANUMERIC";
150149
break;
151150
default:

0 commit comments

Comments
 (0)