@kolkrabbi/design-editor 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BindDot-CMUtpJPX.js → BindDot-CaZu6Uuz.js} +5 -5
- package/dist/{ColorModesWindow-CWhL6nfm.js → ColorModesWindow-D65R5YR5.js} +289 -359
- package/dist/Timeline-OZsY9CvR.js +910 -0
- package/dist/TreePicker-BQYPaQv3.js +166 -0
- package/dist/{core-EWu8GfXL.js → core-DP3uwW4A.js} +3263 -3861
- package/dist/core.js +5 -5
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +1219 -795
- package/dist/{useLayerEdit-BFcZhiNX.js → effectCategories-DJrQJ7vg.js} +3683 -3931
- package/dist/{effects-DZEmfY7a.js → effects-dbxBWOCp.js} +115 -114
- package/dist/effects.js +1 -1
- package/dist/{generators-D1tFSZgG.js → generators-CQQxNX9W.js} +721 -482
- package/dist/generators.js +1 -1
- package/dist/{host-ZLJKCZ54.js → host-DBTmkJuu.js} +1 -1
- package/dist/{host-CRsCCafL.js → host-DXizGh-A.js} +36 -36
- package/dist/morphStore-DaOLa9oj.js +145 -0
- package/dist/motion-yfgCBe5u.js +4261 -0
- package/dist/motion.js +1 -1
- package/dist/{previewScale-BMkeLc6w.js → previewScale-DsG-A1ZC.js} +1 -1
- package/dist/{rolls-BGtqxVYq.js → rolls-CGma4Bua.js} +1809 -2107
- package/dist/{src-BpTckTDZ.js → src-CMdJeS6j.js} +1 -1
- package/dist/useLayerEdit-CnPxtfWc.js +453 -0
- package/package.json +7 -7
- package/dist/Timeline-BObvcdXF.js +0 -3014
- package/dist/TreePicker-nMf17QGH.js +0 -68
- package/dist/motion-C_u7tsis.js +0 -2295
package/dist/generators.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./generators-
|
|
1
|
+
import { t as e } from "./generators-CQQxNX9W.js";
|
|
2
2
|
export { e as generators };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "./previewScale-
|
|
1
|
+
import { n as e } from "./previewScale-DsG-A1ZC.js";
|
|
2
2
|
import { Dt as t, Et as n, G as r, Gt as i, Ht as a, Ut as o, Vt as s, W as c, _ as l, _t as u, a as d, et as f, f as p, gt as m, h, ht as g, m as _, p as v, t as y, v as b } from "./OrbitControls-DVpLgmKv.js";
|
|
3
3
|
//#region src/filters/gl/synthBase.js
|
|
4
4
|
var x = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", S = class {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as x, r as re } from "./previewScale-
|
|
1
|
+
import { $t as e, tn as t } from "./rolls-CGma4Bua.js";
|
|
2
|
+
import { A as n, B as r, F as i, G as a, H as o, I as s, L as c, M as l, N as u, P as d, R as f, U as p, V as m, W as h, j as g, k as _, ut as v, z as y } from "./effectCategories-DJrQJ7vg.js";
|
|
3
|
+
import { c as ee, d as te, l as b, u as ne } from "./generators-CQQxNX9W.js";
|
|
4
|
+
import { n as x, r as re } from "./previewScale-DsG-A1ZC.js";
|
|
5
5
|
import { A as ie, At as ae, Bt as S, C as oe, D as se, Dt as C, E as ce, Et as w, F as le, Gt as T, Ht as E, Kt as ue, L as D, Lt as de, N as fe, Nt as pe, O, P as me, Pt as he, Rt as ge, S as k, T as A, Ut as _e, Vt as j, _t as M, a as N, at as ve, b as ye, bt as be, c as xe, d as P, et as F, f as I, g as Se, gt as L, h as Ce, ht as we, i as Te, it as Ee, jt as De, k as Oe, m as R, mt as ke, n as Ae, nt as je, o as Me, ot as Ne, p as z, pt as Pe, r as Fe, rt as Ie, st as Le, t as B, tt as Re, u as ze, v as V, vt as Be, x as Ve, yt as He, zt as Ue } from "./OrbitControls-DVpLgmKv.js";
|
|
6
6
|
import { n as We, t as Ge } from "./BufferGeometryUtils-Cc8LNd5v.js";
|
|
7
7
|
//#region src/loops/gl/DriftEngine.js
|
|
@@ -32,7 +32,7 @@ var Ke = {
|
|
|
32
32
|
antialias: !0,
|
|
33
33
|
preserveDrawingBuffer: !0
|
|
34
34
|
}), this.scene = new w(), this.cam = new R();
|
|
35
|
-
let t =
|
|
35
|
+
let t = h[this.family][0];
|
|
36
36
|
this.uniforms = {
|
|
37
37
|
uPhase: { value: 0 },
|
|
38
38
|
uAspect: { value: 1 },
|
|
@@ -82,7 +82,7 @@ var Ke = {
|
|
|
82
82
|
t.uLight.value.set(Math.cos(n), Math.sin(n));
|
|
83
83
|
}
|
|
84
84
|
if (e.period != null && (this.period = e.period), e.speed != null && (this.speed = e.speed), e.style != null && (t.uStyle.value = Ke[e.style] ?? 0), e.palette != null) {
|
|
85
|
-
let n =
|
|
85
|
+
let n = a(this.family, e.palette);
|
|
86
86
|
t.uColors.value = n.cols.map(H), t.uBase.value = H(n.base);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -161,7 +161,7 @@ var Ke = {
|
|
|
161
161
|
uShape: { value: 0 },
|
|
162
162
|
uSides: { value: 6 },
|
|
163
163
|
uBg: { value: U("#000000") },
|
|
164
|
-
uColors: { value:
|
|
164
|
+
uColors: { value: r[0].cols.map(U) }
|
|
165
165
|
}, this.mat = new C({
|
|
166
166
|
vertexShader: Qe,
|
|
167
167
|
fragmentShader: $e,
|
|
@@ -178,18 +178,18 @@ var Ke = {
|
|
|
178
178
|
}
|
|
179
179
|
setParams(e) {
|
|
180
180
|
if (!this.uniforms) return;
|
|
181
|
-
let t = e.look ?
|
|
181
|
+
let t = e.look ? y.find((t) => t.value === e.look) : null;
|
|
182
182
|
t?.p && (e = {
|
|
183
183
|
...e,
|
|
184
184
|
...t.p
|
|
185
185
|
});
|
|
186
186
|
let n = this.uniforms;
|
|
187
|
-
if (e.cat != null && (n.uCat.value = Math.round(e.cat)), e.form != null && (n.uType.value = Math.round(e.form)), e.count != null && (n.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (n.uSize.value = e.size), e.spread != null && (n.uSpread.value = e.spread), e.irid != null && (n.uIrid.value = e.irid), e.hue != null && (n.uHue.value = e.hue), e.sheen != null && (n.uSheen.value = e.sheen), e.gloss != null && (n.uGloss.value = e.gloss), n.uRelief.value = e.relief ?? .9, e.warp != null && (n.uWarp.value = e.warp), e.grain != null && (n.uGrain.value = e.grain), e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.angle != null && (n.uAngle.value = e.angle), n.uFreq.value = e.freq ?? 2, e.winds != null && (n.uWinds.value = e.winds), e.pitch != null && (n.uPitch.value = e.pitch), e.petals != null && (n.uPetals.value = e.petals), n.uSpin.value = e.spin ?? 1, e.mouth != null && (n.uMouth.value = e.mouth), n.uSquash.value = e.squash ?? 1.4, n.uDrop.value = e.drop ?? -.15, n.uPosX.value = e.posX ?? 0, n.uSoft.value = e.soft ?? .4, n.uLines.value = e.lines ?? 0, n.uShape.value = Math.max(0,
|
|
188
|
-
let t =
|
|
187
|
+
if (e.cat != null && (n.uCat.value = Math.round(e.cat)), e.form != null && (n.uType.value = Math.round(e.form)), e.count != null && (n.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (n.uSize.value = e.size), e.spread != null && (n.uSpread.value = e.spread), e.irid != null && (n.uIrid.value = e.irid), e.hue != null && (n.uHue.value = e.hue), e.sheen != null && (n.uSheen.value = e.sheen), e.gloss != null && (n.uGloss.value = e.gloss), n.uRelief.value = e.relief ?? .9, e.warp != null && (n.uWarp.value = e.warp), e.grain != null && (n.uGrain.value = e.grain), e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.angle != null && (n.uAngle.value = e.angle), n.uFreq.value = e.freq ?? 2, e.winds != null && (n.uWinds.value = e.winds), e.pitch != null && (n.uPitch.value = e.pitch), e.petals != null && (n.uPetals.value = e.petals), n.uSpin.value = e.spin ?? 1, e.mouth != null && (n.uMouth.value = e.mouth), n.uSquash.value = e.squash ?? 1.4, n.uDrop.value = e.drop ?? -.15, n.uPosX.value = e.posX ?? 0, n.uSoft.value = e.soft ?? .4, n.uLines.value = e.lines ?? 0, n.uShape.value = Math.max(0, m.indexOf(e.shape ?? "circle")), n.uSides.value = e.sides ?? 6, e.speed != null && (this.speed = e.speed), e.palette != null) {
|
|
188
|
+
let t = r.find((t) => t.value === e.palette) || r[0];
|
|
189
189
|
n.uColors.value = t.cols.map(U);
|
|
190
190
|
}
|
|
191
191
|
if (e.backdrop != null) {
|
|
192
|
-
let t =
|
|
192
|
+
let t = f.find((t) => t.value === e.backdrop) || f[0];
|
|
193
193
|
n.uBg.value = U(t.col);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -256,7 +256,7 @@ var Ke = {
|
|
|
256
256
|
uDir: { value: new j(.3, .95) },
|
|
257
257
|
uBgFade: { value: new j(.2, 1.9) },
|
|
258
258
|
uBg: { value: G("#000000") },
|
|
259
|
-
uColors: { value:
|
|
259
|
+
uColors: { value: r[0].cols.map(G) },
|
|
260
260
|
uType: { value: Array(W).fill(2) },
|
|
261
261
|
uPos: { value: Array.from({ length: W }, () => new j()) },
|
|
262
262
|
uScale: { value: Array.from({ length: W }, () => new j(.6, .6)) },
|
|
@@ -309,11 +309,11 @@ var Ke = {
|
|
|
309
309
|
t.uDir.value.set(Math.sin(n), Math.cos(n));
|
|
310
310
|
}
|
|
311
311
|
if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
|
|
312
|
-
let n =
|
|
312
|
+
let n = r.find((t) => t.value === e.palette) || r[0];
|
|
313
313
|
t.uColors.value = n.cols.map(G);
|
|
314
314
|
}
|
|
315
315
|
if (e.backdrop != null) {
|
|
316
|
-
let n =
|
|
316
|
+
let n = f.find((t) => t.value === e.backdrop) || f[0];
|
|
317
317
|
t.uBg.value = G(n.col);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -382,7 +382,7 @@ var Ke = {
|
|
|
382
382
|
uMetaball: { value: 0 },
|
|
383
383
|
uDir: { value: new j(.3, .95) },
|
|
384
384
|
uBg: { value: q("#000000") },
|
|
385
|
-
uColors: { value:
|
|
385
|
+
uColors: { value: r[0].cols.map(q) },
|
|
386
386
|
uType: { value: Array(K).fill(0) },
|
|
387
387
|
uPos3: { value: Array.from({ length: K }, () => new E()) },
|
|
388
388
|
uScale3: { value: Array.from({ length: K }, () => new E(.7, .7, .7)) },
|
|
@@ -431,11 +431,11 @@ var Ke = {
|
|
|
431
431
|
t.uDir.value.set(Math.sin(n), Math.cos(n));
|
|
432
432
|
}
|
|
433
433
|
if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
|
|
434
|
-
let n =
|
|
434
|
+
let n = r.find((t) => t.value === e.palette) || r[0];
|
|
435
435
|
t.uColors.value = n.cols.map(q);
|
|
436
436
|
}
|
|
437
437
|
if (e.backdrop != null) {
|
|
438
|
-
let n =
|
|
438
|
+
let n = f.find((t) => t.value === e.backdrop) || f[0];
|
|
439
439
|
t.uBg.value = q(n.col);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
@@ -791,7 +791,7 @@ var bt = "#0b0b0e", xt = .004, St = 24, Ct = class {
|
|
|
791
791
|
0,
|
|
792
792
|
0,
|
|
793
793
|
0
|
|
794
|
-
]], this.setCount(1), this.axes = new xe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(
|
|
794
|
+
]], this.setCount(1), this.axes = new xe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(p.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
|
|
795
795
|
preset: "spin",
|
|
796
796
|
animMode: "preset",
|
|
797
797
|
keyframes: [],
|
|
@@ -958,7 +958,7 @@ var bt = "#0b0b0e", xt = .004, St = 24, Ct = class {
|
|
|
958
958
|
this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.flat = !!e.flatShading, this.setMaterialType(e.materialType || "standard"), this.applyMaterialProps();
|
|
959
959
|
let t = !!e.wireframe;
|
|
960
960
|
for (let e of this.items) e.mesh.visible = !t, e.wire.visible = t;
|
|
961
|
-
this.lineMat.linewidth = (e.strokeWidth ?? 3) * xt, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos =
|
|
961
|
+
this.lineMat.linewidth = (e.strokeWidth ?? 3) * xt, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos = o(e.arrangement || "single", e.count ?? 1, e.spread ?? 2.2), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), this.scene.environment = e.environment ? this.ensureEnv() : null, this.axes.visible = !!e.showAxis, this.axes.scale.setScalar(e.axisLength ?? 1.5), this.axes.material.opacity = e.axisOpacity ?? .7;
|
|
962
962
|
}
|
|
963
963
|
r && this.rebuildGeometry();
|
|
964
964
|
}
|
|
@@ -976,7 +976,7 @@ var bt = "#0b0b0e", xt = .004, St = 24, Ct = class {
|
|
|
976
976
|
}
|
|
977
977
|
poseAt(e) {
|
|
978
978
|
let t = this.globals;
|
|
979
|
-
return t.animMode === "keyframe" ?
|
|
979
|
+
return t.animMode === "keyframe" ? te(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
|
|
980
980
|
}
|
|
981
981
|
_applyLive(e) {
|
|
982
982
|
let t = this.material;
|
|
@@ -1096,7 +1096,7 @@ var Dt = class {
|
|
|
1096
1096
|
}, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
|
|
1097
1097
|
}
|
|
1098
1098
|
_rebuild() {
|
|
1099
|
-
this.count =
|
|
1099
|
+
this.count = i(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), c(this.form, this.samples, this.vparArr);
|
|
1100
1100
|
let e = new z();
|
|
1101
1101
|
e.setAttribute("position", new I(this.posArr, 3)), e.setAttribute("color", new I(this.colArr, 3));
|
|
1102
1102
|
let t = this.geometry;
|
|
@@ -1146,7 +1146,7 @@ var Dt = class {
|
|
|
1146
1146
|
dur: this.dur
|
|
1147
1147
|
});
|
|
1148
1148
|
let r = (this.dur > 0 ? n / this.dur : 0) * wt * (t.cycles ?? 2);
|
|
1149
|
-
if (
|
|
1149
|
+
if (s(this.form, this.samples, r, {
|
|
1150
1150
|
amp: t.amp ?? .35,
|
|
1151
1151
|
turns: t.turns,
|
|
1152
1152
|
radius: t.radius,
|
|
@@ -1255,9 +1255,9 @@ var Dt = class {
|
|
|
1255
1255
|
}
|
|
1256
1256
|
_rebuild() {
|
|
1257
1257
|
let e = this.samples * this.samples;
|
|
1258
|
-
this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e),
|
|
1258
|
+
this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), d(this.env, this.samples, this.vparArr);
|
|
1259
1259
|
let t = new z();
|
|
1260
|
-
t.setAttribute("position", new I(this.posArr, 3)), t.setAttribute("color", new I(this.colArr, 3)), t.setIndex(new I(
|
|
1260
|
+
t.setAttribute("position", new I(this.posArr, 3)), t.setAttribute("color", new I(this.colArr, 3)), t.setIndex(new I(g(this.env, this.samples), 1));
|
|
1261
1261
|
let n = this.geometry;
|
|
1262
1262
|
this.geometry = t, this.mesh.geometry = t, n.dispose(), this._recolor();
|
|
1263
1263
|
}
|
|
@@ -1305,8 +1305,8 @@ var Dt = class {
|
|
|
1305
1305
|
t: n,
|
|
1306
1306
|
dur: this.dur
|
|
1307
1307
|
});
|
|
1308
|
-
let
|
|
1309
|
-
if (
|
|
1308
|
+
let r = (this.dur > 0 ? n / this.dur : 0) * Ot * (t.cycles ?? 2);
|
|
1309
|
+
if (u(this.env, this.samples, r, { amp: t.amp ?? .5 }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.geometry.computeVertexNormals(), this.controls.autoRotate = !this.recording && !!t.spin && !t.paused && !l(this.env), this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
|
|
1310
1310
|
let e = this._recStop;
|
|
1311
1311
|
this._recStop = null, e();
|
|
1312
1312
|
}
|
|
@@ -1655,7 +1655,7 @@ function Ut(e, t, n, r) {
|
|
|
1655
1655
|
return o;
|
|
1656
1656
|
}
|
|
1657
1657
|
function Wt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1 } = {}) {
|
|
1658
|
-
let o =
|
|
1658
|
+
let o = v(e >>> 0 || 1), s = (e) => (o() - .5) * 2 * e, c = Math.max(1, Math.round(t)), l = -((c - 1) * r) / 2, u = n, d = [], f = 0, p = (t, n) => {
|
|
1659
1659
|
d.push(new E(t, n, Math.sin(f * 1.7 + e) * i)), f += 1;
|
|
1660
1660
|
};
|
|
1661
1661
|
for (let e = 0; e < c; e++) {
|
|
@@ -2237,7 +2237,7 @@ function pn(t, n, r) {
|
|
|
2237
2237
|
globals: {
|
|
2238
2238
|
preset: r.pose,
|
|
2239
2239
|
animMode: r.animMode === "keyframes" || r.animMode === "keyframe" ? "keyframe" : "preset",
|
|
2240
|
-
keyframes: Array.isArray(r.keyframes) && r.keyframes.length ? r.keyframes :
|
|
2240
|
+
keyframes: Array.isArray(r.keyframes) && r.keyframes.length ? r.keyframes : ne,
|
|
2241
2241
|
loop: !0,
|
|
2242
2242
|
paused: !1,
|
|
2243
2243
|
speed: 0,
|
|
@@ -2378,23 +2378,23 @@ function pn(t, n, r) {
|
|
|
2378
2378
|
}
|
|
2379
2379
|
}
|
|
2380
2380
|
function mn(e, t) {
|
|
2381
|
-
let
|
|
2382
|
-
|
|
2383
|
-
let
|
|
2381
|
+
let r = v(e);
|
|
2382
|
+
r(), r(), r();
|
|
2383
|
+
let i = r(), a = .12 + r() * .3, o = r() * Math.PI * 2, s = _.find((e) => e.id === t.palette) || _[0];
|
|
2384
2384
|
return {
|
|
2385
2385
|
seed: e,
|
|
2386
2386
|
shape: t.shape || "sphere",
|
|
2387
|
-
colors:
|
|
2387
|
+
colors: s.colors.map((e) => n(e, t.hueShift || 0)),
|
|
2388
2388
|
driver: t.driver ?? 0,
|
|
2389
|
-
distort: (t.distort ?? .5) * (.6 +
|
|
2390
|
-
rotSpeed:
|
|
2391
|
-
phase:
|
|
2389
|
+
distort: (t.distort ?? .5) * (.6 + i * .5),
|
|
2390
|
+
rotSpeed: a,
|
|
2391
|
+
phase: o
|
|
2392
2392
|
};
|
|
2393
2393
|
}
|
|
2394
2394
|
function hn(e, n, { u: r, dt: i }) {
|
|
2395
2395
|
if (e.drive === "phase") n.renderAtPhase(r);
|
|
2396
2396
|
else if (e.drive === "seek") {
|
|
2397
|
-
let e = an.get(n), i = e ?
|
|
2397
|
+
let e = an.get(n), i = e ? b(r, ee(e, t.getLoopSeconds())) : r;
|
|
2398
2398
|
n.seek(i), n.frame(0);
|
|
2399
2399
|
} else n.frame(i);
|
|
2400
2400
|
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { N as e } from "./rolls-CGma4Bua.js";
|
|
2
|
+
import { useSyncExternalStore as t } from "react";
|
|
3
|
+
//#region src/editor/morph/buildMorph.js
|
|
4
|
+
var n = [
|
|
5
|
+
{
|
|
6
|
+
value: "loop",
|
|
7
|
+
label: "Loop"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
value: "pingpong",
|
|
11
|
+
label: "Ping-pong"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: "once",
|
|
15
|
+
label: "Once"
|
|
16
|
+
}
|
|
17
|
+
], r = e.filter((e) => e.value !== "hold"), i = new Set([
|
|
18
|
+
"range",
|
|
19
|
+
"int",
|
|
20
|
+
"color"
|
|
21
|
+
]), a = [
|
|
22
|
+
"loopGroup",
|
|
23
|
+
"presetId",
|
|
24
|
+
"presetLabel"
|
|
25
|
+
], o = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t);
|
|
26
|
+
function s(e, t, n) {
|
|
27
|
+
let r = t === "loop" ? [...e, e[0]] : t === "pingpong" ? [...e, ...e.slice(0, -1).reverse()] : e, i = r.length - 1;
|
|
28
|
+
return r.map((e, t) => ({
|
|
29
|
+
t: i ? t / i : 0,
|
|
30
|
+
v: e,
|
|
31
|
+
easing: n
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
function c(e, t) {
|
|
35
|
+
return (Array.isArray(e?.layers) ? e.layers : []).find((e) => e && e.type === "loop" && e.loopId === t) ?? null;
|
|
36
|
+
}
|
|
37
|
+
function l({ snapshots: e, schema: t, curve: r = "in-out", cycle: c = "loop", stepSeeds: l = !1 }) {
|
|
38
|
+
if (!Array.isArray(e) || e.length < 2) throw Error("buildMorph: two or more snapshots");
|
|
39
|
+
if (!n.some((e) => e.value === c)) throw Error(`buildMorph: unknown cycle ${c}`);
|
|
40
|
+
let u = e[0], d = {};
|
|
41
|
+
for (let e of a) u[e] !== void 0 && (d[e] = u[e]);
|
|
42
|
+
let f = [], p = [], m = [];
|
|
43
|
+
for (let n of t) {
|
|
44
|
+
let t = e.map((e) => e[n.key] === void 0 ? n.default : e[n.key]);
|
|
45
|
+
if (t.every((e) => o(e, t[0]))) {
|
|
46
|
+
t[0] !== void 0 && (d[n.key] = t[0]);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (n.key === "seed" && !l) {
|
|
50
|
+
d[n.key] = t[0], m.push(n);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
let a = n.key === "seed" || !i.has(n.type);
|
|
54
|
+
d[n.key] = {
|
|
55
|
+
bind: "track",
|
|
56
|
+
keys: s(t, c, a ? "hold" : r)
|
|
57
|
+
}, (a ? p : f).push(n);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
patch: d,
|
|
61
|
+
tweened: f,
|
|
62
|
+
stepped: p,
|
|
63
|
+
held: m
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/editor/morph/morphStore.js
|
|
68
|
+
var u = {
|
|
69
|
+
active: !1,
|
|
70
|
+
mode: "shape",
|
|
71
|
+
resolution: 0,
|
|
72
|
+
editRequest: null,
|
|
73
|
+
loopId: null,
|
|
74
|
+
steps: [],
|
|
75
|
+
curve: "in-out",
|
|
76
|
+
cycle: "loop",
|
|
77
|
+
syncLoop: !1,
|
|
78
|
+
seconds: 4,
|
|
79
|
+
editing: null,
|
|
80
|
+
fileId: null,
|
|
81
|
+
fileName: null,
|
|
82
|
+
picker: null,
|
|
83
|
+
presetId: null
|
|
84
|
+
}, d = { ...u }, f = /* @__PURE__ */ new Set(), p = () => f.forEach((e) => e()), m = (e) => (f.add(e), () => f.delete(e)), h = () => d, g = () => t(m, h, h);
|
|
85
|
+
function _(e) {
|
|
86
|
+
d = {
|
|
87
|
+
...d,
|
|
88
|
+
...e
|
|
89
|
+
}, p();
|
|
90
|
+
}
|
|
91
|
+
function v(e = {}) {
|
|
92
|
+
d = {
|
|
93
|
+
...u,
|
|
94
|
+
...e
|
|
95
|
+
}, p();
|
|
96
|
+
}
|
|
97
|
+
function y(e) {
|
|
98
|
+
d = {
|
|
99
|
+
...d,
|
|
100
|
+
active: !0,
|
|
101
|
+
loopId: d.loopId ?? e.loopId,
|
|
102
|
+
steps: [...d.steps, e]
|
|
103
|
+
}, p();
|
|
104
|
+
}
|
|
105
|
+
function b(e, t) {
|
|
106
|
+
let n = d.steps[e];
|
|
107
|
+
if (!n) return;
|
|
108
|
+
let r = d.steps.slice();
|
|
109
|
+
r[e] = {
|
|
110
|
+
...n,
|
|
111
|
+
params: { ...t }
|
|
112
|
+
}, d = {
|
|
113
|
+
...d,
|
|
114
|
+
steps: r
|
|
115
|
+
}, p();
|
|
116
|
+
}
|
|
117
|
+
function x(e) {
|
|
118
|
+
let t = d.steps.filter((t, n) => n !== e);
|
|
119
|
+
d = {
|
|
120
|
+
...d,
|
|
121
|
+
steps: t,
|
|
122
|
+
loopId: t.length ? d.loopId : null,
|
|
123
|
+
editing: d.editing === e ? null : d.editing
|
|
124
|
+
}, p();
|
|
125
|
+
}
|
|
126
|
+
function S(e, t) {
|
|
127
|
+
let n = d.steps.length;
|
|
128
|
+
if (e === t || e < 0 || e >= n || t < 0 || t >= n) return;
|
|
129
|
+
let r = d.steps.slice(), [i] = r.splice(e, 1);
|
|
130
|
+
r.splice(t, 0, i);
|
|
131
|
+
let a = d.editing, o = a == null ? a : a === e ? t : e < a && a <= t ? a - 1 : t <= a && a < e ? a + 1 : a;
|
|
132
|
+
d = {
|
|
133
|
+
...d,
|
|
134
|
+
steps: r,
|
|
135
|
+
editing: o
|
|
136
|
+
}, p();
|
|
137
|
+
}
|
|
138
|
+
function C(e, t) {
|
|
139
|
+
let n = {};
|
|
140
|
+
for (let r of t) n[r.key] = e?.[r.key] === void 0 ? r.default : e[r.key];
|
|
141
|
+
return n;
|
|
142
|
+
}
|
|
143
|
+
var w = (e, t) => e.source?.label || `Step ${t + 1}`;
|
|
144
|
+
//#endregion
|
|
145
|
+
export { S as a, w as c, r as d, n as f, c as h, x as i, b as l, s as m, h as n, v as o, l as p, C as r, _ as s, y as t, g as u };
|