@kolkrabbi/design-editor 0.12.0 → 0.14.0
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-xnv1FDLI.js +125 -0
- package/dist/EditorIcon-BbFMmc1G.js +22919 -0
- package/dist/RuleRow-D0nV-GvB.js +584 -0
- package/dist/TreePicker-DlEXH2kw.js +303 -0
- package/dist/core-EQZBciYo.js +14113 -0
- package/dist/core.js +3 -0
- package/dist/design-editor.css +1 -2
- package/dist/design-editor.js +728 -77801
- package/dist/effects-C0ojfSm8.js +4548 -0
- package/dist/effects.js +2 -0
- package/dist/generators-RjXuwET7.js +2958 -0
- package/dist/generators.js +2 -0
- package/dist/{host-CVR9RL_W.js → host-BMD1sgpp.js} +89 -86
- package/dist/labels-B10g9Um5.js +40 -0
- package/dist/motion-ejcDWbeh.js +4319 -0
- package/dist/motion.js +2 -0
- package/dist/registry-C7rLJN2U.js +28794 -0
- package/dist/{src-QwKcYKfv.js → src-BOZt8ciR.js} +1 -1
- package/dist/useLayerEdit-BElo4uVW.js +256 -0
- package/package.json +26 -14
- package/dist/phase-t_DhU5Nm.js +0 -1719
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { zt as e } from "./EditorIcon-BbFMmc1G.js";
|
|
2
|
+
import { C as t, D as n, E as r, J as i, O as a, S as o, T as s, _ as c, b as l, g as u, h as d, k as f, m as p, v as m, w as h, x as g, y as _ } from "./registry-C7rLJN2U.js";
|
|
3
|
+
import { a as v } from "./TreePicker-DlEXH2kw.js";
|
|
4
|
+
import { a as y, i as ee, o as te, r as b } from "./generators-RjXuwET7.js";
|
|
2
5
|
import { $ as ne, A as x, B as re, C as ie, D as ae, E as oe, F as se, G as S, H as ce, I as le, J as ue, K as de, L as fe, N as C, O as pe, P as me, Q as he, R as ge, S as _e, T as ve, U as ye, V as be, W as w, X as T, Y as E, Z as xe, _ as Se, a as D, at as O, b as Ce, c as we, ct as k, d as A, et as Te, f as j, g as M, i as N, it as P, k as Ee, l as F, lt as De, m as Oe, n as ke, nt as Ae, o as je, ot as I, p as Me, q as Ne, r as L, rt as Pe, s as Fe, st as Ie, t as R, tt as Le, u as z, v as Re, w as B, x as V, y as H, z as ze } from "./OrbitControls-Cql8Rn2i.js";
|
|
3
6
|
//#region src/loops/gl/DriftEngine.js
|
|
4
7
|
var Be = {
|
|
@@ -22,13 +25,13 @@ var Be = {
|
|
|
22
25
|
constructor(e = "air") {
|
|
23
26
|
this.family = e, this.renderer = null, this.time = 0, this.period = 8, this.playing = !0, this.speed = 1;
|
|
24
27
|
}
|
|
25
|
-
init(
|
|
28
|
+
init(e) {
|
|
26
29
|
this.renderer = new D({
|
|
27
|
-
canvas:
|
|
30
|
+
canvas: e,
|
|
28
31
|
antialias: !0,
|
|
29
32
|
preserveDrawingBuffer: !0
|
|
30
33
|
}), this.scene = new E(), this.cam = new j();
|
|
31
|
-
let
|
|
34
|
+
let t = a[this.family][0];
|
|
32
35
|
this.uniforms = {
|
|
33
36
|
uPhase: { value: 0 },
|
|
34
37
|
uAspect: { value: 1 },
|
|
@@ -50,8 +53,8 @@ var Be = {
|
|
|
50
53
|
uFlow: { value: new O(1, 0) },
|
|
51
54
|
uLight: { value: new O(.7, .7) },
|
|
52
55
|
uStyle: { value: 0 },
|
|
53
|
-
uColors: { value:
|
|
54
|
-
uBase: { value: U(
|
|
56
|
+
uColors: { value: t.cols.map(U) },
|
|
57
|
+
uBase: { value: U(t.base) }
|
|
55
58
|
}, this.mat = new T({
|
|
56
59
|
vertexShader: Ve,
|
|
57
60
|
fragmentShader: We[this.family],
|
|
@@ -78,8 +81,8 @@ var Be = {
|
|
|
78
81
|
t.uLight.value.set(Math.cos(n), Math.sin(n));
|
|
79
82
|
}
|
|
80
83
|
if (e.period != null && (this.period = e.period), e.speed != null && (this.speed = e.speed), e.style != null && (t.uStyle.value = Be[e.style] ?? 0), e.palette != null) {
|
|
81
|
-
let
|
|
82
|
-
t.uColors.value =
|
|
84
|
+
let n = f(this.family, e.palette);
|
|
85
|
+
t.uColors.value = n.cols.map(U), t.uBase.value = U(n.base);
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
setPlaying(e) {
|
|
@@ -150,7 +153,7 @@ var Be = {
|
|
|
150
153
|
uSpin: { value: 1 },
|
|
151
154
|
uMouth: { value: .5 },
|
|
152
155
|
uBg: { value: W("#000000") },
|
|
153
|
-
uColors: { value:
|
|
156
|
+
uColors: { value: s[0].cols.map(W) }
|
|
154
157
|
}, this.mat = new T({
|
|
155
158
|
vertexShader: Ke,
|
|
156
159
|
fragmentShader: qe,
|
|
@@ -167,19 +170,19 @@ var Be = {
|
|
|
167
170
|
}
|
|
168
171
|
setParams(e) {
|
|
169
172
|
if (!this.uniforms) return;
|
|
170
|
-
let
|
|
171
|
-
|
|
173
|
+
let n = e.look ? h.find((t) => t.value === e.look) : null;
|
|
174
|
+
n?.p && (e = {
|
|
172
175
|
...e,
|
|
173
|
-
...
|
|
176
|
+
...n.p
|
|
174
177
|
});
|
|
175
|
-
let
|
|
176
|
-
if (e.cat != null && (
|
|
177
|
-
let t =
|
|
178
|
-
|
|
178
|
+
let r = this.uniforms;
|
|
179
|
+
if (e.cat != null && (r.uCat.value = Math.round(e.cat)), e.form != null && (r.uType.value = Math.round(e.form)), e.count != null && (r.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (r.uSize.value = e.size), e.spread != null && (r.uSpread.value = e.spread), e.irid != null && (r.uIrid.value = e.irid), e.hue != null && (r.uHue.value = e.hue), e.sheen != null && (r.uSheen.value = e.sheen), e.gloss != null && (r.uGloss.value = e.gloss), r.uRelief.value = e.relief ?? .9, e.warp != null && (r.uWarp.value = e.warp), e.grain != null && (r.uGrain.value = e.grain), e.spectral != null && (r.uSpectral.value = +!!e.spectral), e.angle != null && (r.uAngle.value = e.angle), r.uFreq.value = e.freq ?? 2, e.winds != null && (r.uWinds.value = e.winds), e.pitch != null && (r.uPitch.value = e.pitch), e.petals != null && (r.uPetals.value = e.petals), r.uSpin.value = e.spin ?? 1, e.mouth != null && (r.uMouth.value = e.mouth), e.speed != null && (this.speed = e.speed), e.palette != null) {
|
|
180
|
+
let t = s.find((t) => t.value === e.palette) || s[0];
|
|
181
|
+
r.uColors.value = t.cols.map(W);
|
|
179
182
|
}
|
|
180
183
|
if (e.backdrop != null) {
|
|
181
|
-
let
|
|
182
|
-
|
|
184
|
+
let n = t.find((t) => t.value === e.backdrop) || t[0];
|
|
185
|
+
r.uBg.value = W(n.col);
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
setPlaying(e) {
|
|
@@ -245,7 +248,7 @@ var Be = {
|
|
|
245
248
|
uDir: { value: new O(.3, .95) },
|
|
246
249
|
uBgFade: { value: new O(.2, 1.9) },
|
|
247
250
|
uBg: { value: Qe("#000000") },
|
|
248
|
-
uColors: { value:
|
|
251
|
+
uColors: { value: s[0].cols.map(Qe) },
|
|
249
252
|
uType: { value: Array(G).fill(2) },
|
|
250
253
|
uPos: { value: Array.from({ length: G }, () => new O()) },
|
|
251
254
|
uScale: { value: Array.from({ length: G }, () => new O(.6, .6)) },
|
|
@@ -278,7 +281,7 @@ var Be = {
|
|
|
278
281
|
}
|
|
279
282
|
setParams(e) {
|
|
280
283
|
if (!this.uniforms) return;
|
|
281
|
-
let
|
|
284
|
+
let n = this.uniforms, r = {
|
|
282
285
|
hue: "uHue",
|
|
283
286
|
irid: "uIrid",
|
|
284
287
|
sheen: "uSheen",
|
|
@@ -292,18 +295,18 @@ var Be = {
|
|
|
292
295
|
grain: "uGrain",
|
|
293
296
|
edge: "uEdge"
|
|
294
297
|
};
|
|
295
|
-
for (let
|
|
296
|
-
if (
|
|
297
|
-
let
|
|
298
|
-
|
|
298
|
+
for (let t in r) e[t] != null && (n[r[t]].value = e[t]);
|
|
299
|
+
if (n.uBulge.value = e.bulge ?? .55, e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.sweep != null) {
|
|
300
|
+
let t = e.sweep * Math.PI / 180;
|
|
301
|
+
n.uDir.value.set(Math.sin(t), Math.cos(t));
|
|
299
302
|
}
|
|
300
303
|
if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
|
|
301
|
-
let
|
|
302
|
-
|
|
304
|
+
let t = s.find((t) => t.value === e.palette) || s[0];
|
|
305
|
+
n.uColors.value = t.cols.map(Qe);
|
|
303
306
|
}
|
|
304
307
|
if (e.backdrop != null) {
|
|
305
|
-
let
|
|
306
|
-
|
|
308
|
+
let r = t.find((t) => t.value === e.backdrop) || t[0];
|
|
309
|
+
n.uBg.value = Qe(r.col);
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
312
|
setPlaying(e) {
|
|
@@ -371,7 +374,7 @@ var Be = {
|
|
|
371
374
|
uMetaball: { value: 0 },
|
|
372
375
|
uDir: { value: new O(.3, .95) },
|
|
373
376
|
uBg: { value: rt("#000000") },
|
|
374
|
-
uColors: { value:
|
|
377
|
+
uColors: { value: s[0].cols.map(rt) },
|
|
375
378
|
uType: { value: Array(K).fill(0) },
|
|
376
379
|
uPos3: { value: Array.from({ length: K }, () => new I()) },
|
|
377
380
|
uScale3: { value: Array.from({ length: K }, () => new I(.7, .7, .7)) },
|
|
@@ -402,7 +405,7 @@ var Be = {
|
|
|
402
405
|
}
|
|
403
406
|
setParams(e) {
|
|
404
407
|
if (!this.uniforms) return;
|
|
405
|
-
let
|
|
408
|
+
let n = this.uniforms, r = {
|
|
406
409
|
hue: "uHue",
|
|
407
410
|
irid: "uIrid",
|
|
408
411
|
sheen: "uSheen",
|
|
@@ -414,18 +417,18 @@ var Be = {
|
|
|
414
417
|
motion: "uMotion",
|
|
415
418
|
grain: "uGrain"
|
|
416
419
|
};
|
|
417
|
-
for (let
|
|
418
|
-
if (e.spectral != null && (
|
|
419
|
-
let
|
|
420
|
-
|
|
420
|
+
for (let t in r) e[t] != null && (n[r[t]].value = e[t]);
|
|
421
|
+
if (e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.metaball != null && (n.uMetaball.value = +!!e.metaball), e.sweep != null) {
|
|
422
|
+
let t = e.sweep * Math.PI / 180;
|
|
423
|
+
n.uDir.value.set(Math.sin(t), Math.cos(t));
|
|
421
424
|
}
|
|
422
425
|
if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
|
|
423
|
-
let
|
|
424
|
-
|
|
426
|
+
let t = s.find((t) => t.value === e.palette) || s[0];
|
|
427
|
+
n.uColors.value = t.cols.map(rt);
|
|
425
428
|
}
|
|
426
429
|
if (e.backdrop != null) {
|
|
427
|
-
let
|
|
428
|
-
|
|
430
|
+
let r = t.find((t) => t.value === e.backdrop) || t[0];
|
|
431
|
+
n.uBg.value = rt(r.col);
|
|
429
432
|
}
|
|
430
433
|
}
|
|
431
434
|
setPlaying(e) {
|
|
@@ -768,10 +771,10 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
|
|
|
768
771
|
preserveDrawingBuffer: !0,
|
|
769
772
|
alpha: !0
|
|
770
773
|
}), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(gt), 1), this.scene = new E(), this.camera = new w(38, 1, .1, 100), this.camera.position.set(0, .6, 4), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.scene.add(new je(16777215, .35)), this.scene.add(new ve(13424383, 2105384, .5));
|
|
771
|
-
let
|
|
772
|
-
|
|
773
|
-
let
|
|
774
|
-
|
|
774
|
+
let r = new H(16777215, 1.5);
|
|
775
|
+
r.position.set(3, 4, 2), this.scene.add(r);
|
|
776
|
+
let i = new H(10070783, .5);
|
|
777
|
+
i.position.set(-3, -1, -2), this.scene.add(i), this.pmrem = new ke(this.renderer), this.envTex = null, this.color = "#b9c2d0", this.roughness = .38, this.metalness = .18, this.flat = !1, this.matType = "standard", this.material = this.makeMaterial("standard"), this.lineMat = new lt({
|
|
775
778
|
color: 12174032,
|
|
776
779
|
linewidth: 3 * _t,
|
|
777
780
|
worldUnits: !0
|
|
@@ -784,7 +787,7 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
|
|
|
784
787
|
0,
|
|
785
788
|
0,
|
|
786
789
|
0
|
|
787
|
-
]], this.setCount(1), this.axes = new Fe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(
|
|
790
|
+
]], this.setCount(1), this.axes = new Fe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(n.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
|
|
788
791
|
preset: "spin",
|
|
789
792
|
animMode: "preset",
|
|
790
793
|
keyframes: [],
|
|
@@ -902,17 +905,17 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
|
|
|
902
905
|
return this.envTex ||= this.pmrem.fromScene(new ht(), .04).texture, this.envTex;
|
|
903
906
|
}
|
|
904
907
|
update({ globals: e, primitive: t, params: n } = {}) {
|
|
905
|
-
let
|
|
906
|
-
if (t && t !== this.primId && (this.primId = t,
|
|
908
|
+
let i = !1;
|
|
909
|
+
if (t && t !== this.primId && (this.primId = t, i = !0), n && (this.params = {
|
|
907
910
|
...this.params,
|
|
908
911
|
...n
|
|
909
|
-
},
|
|
912
|
+
}, i = !0), e) {
|
|
910
913
|
this.globals = e, 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();
|
|
911
914
|
let t = !!e.wireframe;
|
|
912
915
|
for (let e of this.items) e.mesh.visible = !t, e.wire.visible = t;
|
|
913
|
-
this.lineMat.linewidth = (e.strokeWidth ?? 3) * _t, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (
|
|
916
|
+
this.lineMat.linewidth = (e.strokeWidth ?? 3) * _t, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (i = !0)), this.setCount(e.count ?? 1), this.layoutPos = r(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;
|
|
914
917
|
}
|
|
915
|
-
|
|
918
|
+
i && this.rebuildGeometry();
|
|
916
919
|
}
|
|
917
920
|
resize(e, t) {
|
|
918
921
|
this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
|
|
@@ -928,7 +931,7 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
|
|
|
928
931
|
}
|
|
929
932
|
poseAt(e) {
|
|
930
933
|
let t = this.globals;
|
|
931
|
-
return t.animMode === "keyframe" ?
|
|
934
|
+
return t.animMode === "keyframe" ? te(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
|
|
932
935
|
}
|
|
933
936
|
_applyLive(e) {
|
|
934
937
|
let t = this.material;
|
|
@@ -1046,7 +1049,7 @@ var Ct = class {
|
|
|
1046
1049
|
}, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
|
|
1047
1050
|
}
|
|
1048
1051
|
_rebuild() {
|
|
1049
|
-
this.count =
|
|
1052
|
+
this.count = l(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), o(this.form, this.samples, this.vparArr);
|
|
1050
1053
|
let e = new A();
|
|
1051
1054
|
e.setAttribute("position", new z(this.posArr, 3)), e.setAttribute("color", new z(this.colArr, 3));
|
|
1052
1055
|
let t = this.geometry;
|
|
@@ -1096,7 +1099,7 @@ var Ct = class {
|
|
|
1096
1099
|
dur: this.dur
|
|
1097
1100
|
});
|
|
1098
1101
|
let r = (this.dur > 0 ? n / this.dur : 0) * bt * (t.cycles ?? 2);
|
|
1099
|
-
if (
|
|
1102
|
+
if (g(this.form, this.samples, r, {
|
|
1100
1103
|
amp: t.amp ?? .35,
|
|
1101
1104
|
turns: t.turns,
|
|
1102
1105
|
radius: t.radius,
|
|
@@ -1205,9 +1208,9 @@ var Ct = class {
|
|
|
1205
1208
|
}
|
|
1206
1209
|
_rebuild() {
|
|
1207
1210
|
let e = this.samples * this.samples;
|
|
1208
|
-
this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e),
|
|
1211
|
+
this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), _(this.env, this.samples, this.vparArr);
|
|
1209
1212
|
let t = new A();
|
|
1210
|
-
t.setAttribute("position", new z(this.posArr, 3)), t.setAttribute("color", new z(this.colArr, 3)), t.setIndex(new z(
|
|
1213
|
+
t.setAttribute("position", new z(this.posArr, 3)), t.setAttribute("color", new z(this.colArr, 3)), t.setIndex(new z(u(this.env, this.samples), 1));
|
|
1211
1214
|
let n = this.geometry;
|
|
1212
1215
|
this.geometry = t, this.mesh.geometry = t, n.dispose(), this._recolor();
|
|
1213
1216
|
}
|
|
@@ -1256,7 +1259,7 @@ var Ct = class {
|
|
|
1256
1259
|
dur: this.dur
|
|
1257
1260
|
});
|
|
1258
1261
|
let r = (this.dur > 0 ? n / this.dur : 0) * wt * (t.cycles ?? 2);
|
|
1259
|
-
if (
|
|
1262
|
+
if (m(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 && !c(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) {
|
|
1260
1263
|
let e = this._recStop;
|
|
1261
1264
|
this._recStop = null, e();
|
|
1262
1265
|
}
|
|
@@ -1604,29 +1607,29 @@ function zt(e, t, n, r) {
|
|
|
1604
1607
|
}
|
|
1605
1608
|
return o;
|
|
1606
1609
|
}
|
|
1607
|
-
function Bt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth:
|
|
1608
|
-
let
|
|
1609
|
-
|
|
1610
|
+
function Bt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: a = .35, curl: o = 1 } = {}) {
|
|
1611
|
+
let s = i(e >>> 0 || 1), c = (e) => (s() - .5) * 2 * e, l = Math.max(1, Math.round(t)), u = -((l - 1) * r) / 2, d = n, f = [], p = 0, m = (t, n) => {
|
|
1612
|
+
f.push(new I(t, n, Math.sin(p * 1.7 + e) * a)), p += 1;
|
|
1610
1613
|
};
|
|
1611
|
-
for (let e = 0; e <
|
|
1612
|
-
let t =
|
|
1614
|
+
for (let e = 0; e < l; e++) {
|
|
1615
|
+
let t = u + e * r + c(r * .06), n = e % 2 == 0, i = n ? -d / 2 : d / 2, a = n ? d / 2 : -d / 2;
|
|
1613
1616
|
for (let e = 0; e < 10; e++) m(t, i + (a - i) * e / 10);
|
|
1614
|
-
if (e <
|
|
1615
|
-
let i =
|
|
1617
|
+
if (e < l - 1) {
|
|
1618
|
+
let i = u + (e + 1) * r, o = (t + i) / 2, s = (i - t) / 2, c = n ? 1 : -1;
|
|
1616
1619
|
for (let e = 0; e <= 24; e++) {
|
|
1617
1620
|
let t = e / 24 * Math.PI;
|
|
1618
1621
|
m(o - Math.cos(t) * s, a + c * Math.sin(t) * s);
|
|
1619
1622
|
}
|
|
1620
1623
|
}
|
|
1621
1624
|
}
|
|
1622
|
-
if (
|
|
1623
|
-
let t =
|
|
1625
|
+
if (o > 0 && f.length >= 2) {
|
|
1626
|
+
let t = f[f.length - 1], n = f[f.length - 2], i = t.clone().sub(n).setZ(0).normalize(), s = new I(-i.y, i.x, 0).normalize(), c = r * .5, l = t.clone().add(s.clone().multiplyScalar(c)), u = Math.atan2(t.y - l.y, t.x - l.x), d = 1.1 * o;
|
|
1624
1627
|
for (let n = 1; n <= 44; n++) {
|
|
1625
|
-
let r = n / 44,
|
|
1626
|
-
|
|
1628
|
+
let r = n / 44, i = u - d * Math.PI * 2 * r, o = c * (1 - .7 * r);
|
|
1629
|
+
f.push(new I(l.x + Math.cos(i) * o, l.y + Math.sin(i) * o, t.z + Math.sin(r * 3 + e) * a * .4));
|
|
1627
1630
|
}
|
|
1628
1631
|
}
|
|
1629
|
-
return new Oe(
|
|
1632
|
+
return new Oe(f, !1, "centripetal");
|
|
1630
1633
|
}
|
|
1631
1634
|
function Vt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1, width: o = .5, ribbonThickness: s = .12, corner: c = .045, tubularSegments: l = 800, radialSegments: u = 48 } = {}) {
|
|
1632
1635
|
let d = Bt({
|
|
@@ -2156,20 +2159,20 @@ var on = {
|
|
|
2156
2159
|
paused: !1,
|
|
2157
2160
|
speed: 0
|
|
2158
2161
|
};
|
|
2159
|
-
function sn(
|
|
2160
|
-
if (cn(
|
|
2161
|
-
let
|
|
2162
|
-
if (
|
|
2163
|
-
let
|
|
2164
|
-
|
|
2165
|
-
x:
|
|
2162
|
+
function sn(t, n, r) {
|
|
2163
|
+
if (cn(t, n, r), typeof n.setPointer == "function") {
|
|
2164
|
+
let t = e.getCtx().stage, i = r.w ?? 0, a = r.h ?? 0, o = null;
|
|
2165
|
+
if (t && i > 0 && a > 0) {
|
|
2166
|
+
let e = (t.x - (r.x ?? 0)) / i, n = (t.y - (r.y ?? 0)) / a;
|
|
2167
|
+
e >= 0 && e <= 1 && n >= 0 && n <= 1 && (o = {
|
|
2168
|
+
x: e,
|
|
2166
2169
|
y: n,
|
|
2167
|
-
down: !!
|
|
2170
|
+
down: !!t.down
|
|
2168
2171
|
});
|
|
2169
2172
|
}
|
|
2170
2173
|
n.setPointer(o);
|
|
2171
2174
|
}
|
|
2172
|
-
|
|
2175
|
+
t.bgToggle && n.renderer?.setClearAlpha(r.bgOn === !1 ? 0 : 1);
|
|
2173
2176
|
}
|
|
2174
2177
|
function cn(e, t, n) {
|
|
2175
2178
|
switch (e.engine) {
|
|
@@ -2187,7 +2190,7 @@ function cn(e, t, n) {
|
|
|
2187
2190
|
globals: {
|
|
2188
2191
|
preset: n.pose,
|
|
2189
2192
|
animMode: n.animMode === "keyframes" || n.animMode === "keyframe" ? "keyframe" : "preset",
|
|
2190
|
-
keyframes: Array.isArray(n.keyframes) && n.keyframes.length ? n.keyframes :
|
|
2193
|
+
keyframes: Array.isArray(n.keyframes) && n.keyframes.length ? n.keyframes : y,
|
|
2191
2194
|
loop: !0,
|
|
2192
2195
|
paused: !1,
|
|
2193
2196
|
speed: 0,
|
|
@@ -2310,30 +2313,30 @@ function cn(e, t, n) {
|
|
|
2310
2313
|
bg: n.bgAmount ?? .85,
|
|
2311
2314
|
bgStyle: n.bgStyle ?? 0
|
|
2312
2315
|
}
|
|
2313
|
-
}), t.setBackground(
|
|
2316
|
+
}), t.setBackground(v(n.themeId ?? "kol", !!n.themeInvert).bg);
|
|
2314
2317
|
return;
|
|
2315
2318
|
}
|
|
2316
2319
|
default: t.setParams(n);
|
|
2317
2320
|
}
|
|
2318
2321
|
}
|
|
2319
2322
|
function ln(e, t) {
|
|
2320
|
-
let n =
|
|
2323
|
+
let n = i(e);
|
|
2321
2324
|
n(), n(), n();
|
|
2322
|
-
let r = n(),
|
|
2325
|
+
let r = n(), a = .12 + n() * .3, o = n() * Math.PI * 2, s = p.find((e) => e.id === t.palette) || p[0];
|
|
2323
2326
|
return {
|
|
2324
2327
|
seed: e,
|
|
2325
2328
|
shape: t.shape || "sphere",
|
|
2326
|
-
colors:
|
|
2329
|
+
colors: s.colors.map((e) => d(e, t.hueShift || 0)),
|
|
2327
2330
|
driver: t.driver ?? 0,
|
|
2328
2331
|
distort: (t.distort ?? .5) * (.6 + r * .5),
|
|
2329
|
-
rotSpeed:
|
|
2330
|
-
phase:
|
|
2332
|
+
rotSpeed: a,
|
|
2333
|
+
phase: o
|
|
2331
2334
|
};
|
|
2332
2335
|
}
|
|
2333
|
-
function un(
|
|
2334
|
-
if (
|
|
2335
|
-
else if (
|
|
2336
|
-
let
|
|
2336
|
+
function un(t, n, { u: r, dt: i }) {
|
|
2337
|
+
if (t.drive === "phase") n.renderAtPhase(r);
|
|
2338
|
+
else if (t.drive === "seek") {
|
|
2339
|
+
let t = $t.get(n), i = t ? ee(r, b(t, e.getLoopSeconds())) : r;
|
|
2337
2340
|
n.seek(i), n.frame(0);
|
|
2338
2341
|
} else n.frame(i);
|
|
2339
2342
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/editor/compose/labels.js
|
|
2
|
+
var e = {
|
|
3
|
+
background: "Background",
|
|
4
|
+
pattern: "Pattern",
|
|
5
|
+
photo: "Photo",
|
|
6
|
+
shape: "Shape",
|
|
7
|
+
text: "Text",
|
|
8
|
+
group: "Group",
|
|
9
|
+
bool: "Boolean",
|
|
10
|
+
loop: "Loop",
|
|
11
|
+
kinetic: "Kinetic type",
|
|
12
|
+
misc: "Misc"
|
|
13
|
+
}, t = {
|
|
14
|
+
unite: "Unite",
|
|
15
|
+
subtract: "Subtract",
|
|
16
|
+
intersect: "Intersect",
|
|
17
|
+
exclude: "Exclude"
|
|
18
|
+
}, n = {
|
|
19
|
+
logo: "Logo",
|
|
20
|
+
rect: "Rectangle",
|
|
21
|
+
ellipse: "Ellipse",
|
|
22
|
+
triangle: "Triangle",
|
|
23
|
+
line: "Line",
|
|
24
|
+
polygon: "Polygon",
|
|
25
|
+
star: "Star",
|
|
26
|
+
flatten: "Flatten"
|
|
27
|
+
};
|
|
28
|
+
function r(r) {
|
|
29
|
+
if (r.type === "shape") return `Shape · ${n[r.kind ?? "logo"] ?? "Shape"}`;
|
|
30
|
+
if (r.type === "bool") {
|
|
31
|
+
let n = t[r.op];
|
|
32
|
+
return n ? `Boolean · ${n}` : e.bool;
|
|
33
|
+
}
|
|
34
|
+
return r.type === "loop" && r.presetLabel ? `Loop · ${r.presetLabel}` : r.type === "misc" && r.presetLabel ? `Misc · ${r.presetLabel}` : r.type === "kinetic" && r.presetLabel ? `Kinetic · ${r.presetLabel}` : e[r.type] ?? r.type;
|
|
35
|
+
}
|
|
36
|
+
function i(r) {
|
|
37
|
+
return r.name ? r.name : r.type === "text" ? r.text || e.text : r.type === "shape" ? n[r.kind ?? "logo"] ?? e.shape : r.type === "bool" ? t[r.op] ?? e.bool : r.type === "loop" || r.type === "misc" ? r.presetLabel || e[r.type] : r.type === "kinetic" ? r.presetLabel || e.kinetic : e[r.type] ?? r.type;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { i as n, r as t };
|