@kolkrabbi/design-editor 0.20.0 → 0.22.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.
@@ -1,4229 +0,0 @@
1
- import { A as e, It as t, S as n, Zt as r, c as i, ct as a, dt as o, f as s, ft as c, j as l, l as u, lt as d, m as f, t as p, ut as m, y as h } from "./rolls-CkmuE-Ya.js";
2
- import { _ as g, a as _, d as v, f as y, g as b, h as x, i as S, l as C, m as w, p as ee, r as te, s as ne, u as T, y as E } from "./TreePicker-D5XZT0Zi.js";
3
- import { t as D } from "./labels-B10g9Um5.js";
4
- import { Button as O, Dropdown as re, Input as ie, LabeledControl as ae, MenuDropdownItem as oe, PopoverPanel as se, SegmentedToggle as k, Slider as A, Textarea as ce, TimelineDock as le, ToggleCheckbox as ue, Tooltip as j, ViewToggle as de, glyphSize as fe, usePopover as pe } from "@kolkrabbi/kol-component";
5
- import { Fragment as me, useEffect as he, useMemo as ge, useRef as _e, useState as M } from "react";
6
- import { Fragment as ve, jsx as N, jsxs as P } from "react/jsx-runtime";
7
- import { Icon as F } from "@kolkrabbi/kol-icons";
8
- //#region src/kinetic/paths.js
9
- var ye = Math.PI * 2, I = (e) => Math.round(e * 100) / 100;
10
- function be(e) {
11
- return e.map((e, t) => `${t === 0 ? "M" : "L"} ${I(e[0])} ${I(e[1])}`).join(" ");
12
- }
13
- var xe = [
14
- [.12, .55],
15
- [.37, .32],
16
- [.63, .68],
17
- [.88, .45]
18
- ];
19
- function Se(e, t, n) {
20
- let r = e.map(([e, r]) => [e * t, r * n]);
21
- if (r.length < 2) return `M ${I(t / 2)} ${I(n / 2)} L ${I(t / 2 + 1)} ${I(n / 2)}`;
22
- let i = `M ${I(r[0][0])} ${I(r[0][1])}`;
23
- for (let e = 0; e < r.length - 1; e++) {
24
- let t = r[e - 1] || r[e], n = r[e], a = r[e + 1], o = r[e + 2] || r[e + 1], s = n[0] + (a[0] - t[0]) / 6, c = n[1] + (a[1] - t[1]) / 6, l = a[0] - (o[0] - n[0]) / 6, u = a[1] - (o[1] - n[1]) / 6;
25
- i += ` C ${I(s)} ${I(c)} ${I(l)} ${I(u)} ${I(a[0])} ${I(a[1])}`;
26
- }
27
- return i;
28
- }
29
- var L = (e) => e === "array", Ce = (e) => e === "radial", we = (e) => e === "rings", Te = {
30
- amp: .4,
31
- freq: 2,
32
- turns: 3,
33
- radius: .72,
34
- rows: 2,
35
- cols: 3,
36
- count: 12,
37
- inner: .12,
38
- spin: 1,
39
- twist: .5,
40
- grow: .6
41
- };
42
- function Ee(e, t, n, r = {}) {
43
- let i = t / 2, a = n / 2, o = Math.min(t, n) * .12, s = r.amp ?? Te.amp, c = Math.max(1, Math.round(r.freq ?? Te.freq)), l = Math.max(1, Math.round(r.turns ?? Te.turns)), u = r.radius ?? Te.radius;
44
- switch (e) {
45
- case "arc": {
46
- let e = n * .62, r = e - s * n * .7;
47
- return {
48
- d: `M ${I(o)} ${I(e)} Q ${I(i)} ${I(r)} ${I(t - o)} ${I(e)}`,
49
- closed: !1
50
- };
51
- }
52
- case "circle": {
53
- let e = Math.min(t, n) * .5 * u;
54
- return {
55
- d: `M ${I(i - e)} ${I(a)} A ${I(e)} ${I(e)} 0 1 1 ${I(i + e)} ${I(a)} A ${I(e)} ${I(e)} 0 1 1 ${I(i - e)} ${I(a)} Z`,
56
- closed: !0
57
- };
58
- }
59
- case "ellipse": {
60
- let e = (t * .5 - o) * u, r = (n * .5 - o) * u;
61
- return {
62
- d: `M ${I(i - e)} ${I(a)} A ${I(e)} ${I(r)} 0 1 1 ${I(i + e)} ${I(a)} A ${I(e)} ${I(r)} 0 1 1 ${I(i - e)} ${I(a)} Z`,
63
- closed: !0
64
- };
65
- }
66
- case "sine": {
67
- let e = [];
68
- for (let r = 0; r <= 120; r++) {
69
- let i = r / 120;
70
- e.push([o + i * (t - 2 * o), a + s * n * .32 * Math.sin(i * c * ye)]);
71
- }
72
- return {
73
- d: be(e),
74
- closed: !1
75
- };
76
- }
77
- case "spiral": {
78
- let e = Math.min(t, n) * .45 * u, r = [];
79
- for (let t = 0; t <= 420; t++) {
80
- let n = t / 420, o = n * l * ye, s = n * e;
81
- r.push([i + Math.cos(o) * s, a + Math.sin(o) * s]);
82
- }
83
- return {
84
- d: be(r),
85
- closed: !1
86
- };
87
- }
88
- case "zigzag": {
89
- let e = c * 2, r = [];
90
- for (let i = 0; i <= e; i++) {
91
- let c = i / e;
92
- r.push([o + c * (t - 2 * o), a + (i % 2 == 0 ? -1 : 1) * s * n * .28]);
93
- }
94
- return {
95
- d: be(r),
96
- closed: !1
97
- };
98
- }
99
- case "custom": return {
100
- d: Se(Array.isArray(r.points) && r.points.length >= 2 ? r.points : xe, t, n),
101
- closed: !1
102
- };
103
- default: {
104
- let e = a + (r.offset || 0) * n;
105
- return {
106
- d: `M ${I(o)} ${I(e)} L ${I(t - o)} ${I(e)}`,
107
- closed: !1
108
- };
109
- }
110
- }
111
- }
112
- //#endregion
113
- //#region src/kinetic/presets.js
114
- var De = "#0b0d12", Oe = "#e8e4dc", R = {
115
- text: "Kinetic",
116
- font: "gullhamrar",
117
- fontSize: 120,
118
- fill: "#e8e4dc",
119
- italic: !1,
120
- case: "none",
121
- letterSpacing: 0,
122
- align: "center",
123
- multiply: 1,
124
- group: null,
125
- flow: "flow",
126
- offset: {
127
- x: 0,
128
- y: 0
129
- },
130
- phase: 0,
131
- stagger: 0,
132
- vf: {},
133
- opentype: {},
134
- showPath: !1,
135
- path: {
136
- type: "line",
137
- ...Te
138
- },
139
- motion: {
140
- mode: "none",
141
- cycles: 1,
142
- phase: .5,
143
- amp: .3,
144
- axis: "wght",
145
- field: "x"
146
- },
147
- motions: [],
148
- morph: {
149
- on: !1,
150
- mode: "morph",
151
- vf2: {},
152
- face2: "",
153
- curve: "flat",
154
- blend: .5,
155
- cp1: {
156
- x: .33,
157
- y: .33
158
- },
159
- cp2: {
160
- x: .66,
161
- y: .66
162
- }
163
- }
164
- };
165
- function ke(e, t = {}) {
166
- let n = v(e), r = T(n);
167
- for (let e of n.axes) t[e.tag] != null && (r[e.tag] = t[e.tag]);
168
- return r;
169
- }
170
- function Ae(e = {}, t = 0) {
171
- let n = {
172
- id: e.id || `i${t}`,
173
- ...R,
174
- ...e,
175
- path: {
176
- ...R.path,
177
- ...e.path || {}
178
- },
179
- motion: {
180
- ...R.motion,
181
- ...e.motion || {}
182
- },
183
- motions: Array.isArray(e.motions) ? e.motions.map((e) => ({
184
- ...R.motion,
185
- ...e
186
- })) : [],
187
- offset: {
188
- ...R.offset,
189
- ...e.offset || {}
190
- },
191
- opentype: { ...e.opentype || {} },
192
- morph: {
193
- ...R.morph,
194
- ...e.morph || {},
195
- vf2: { ...e.morph?.vf2 || {} }
196
- }
197
- };
198
- return n.vf = ke(n.font, e.vf), n;
199
- }
200
- var z = (e) => ({
201
- bg: De,
202
- instances: [Ae({
203
- font: "rot",
204
- fill: Oe,
205
- ...e
206
- }, 0)]
207
- }), je = "#16202E", B = (...e) => ({
208
- bg: je,
209
- instances: e.map((e, t) => Ae(e, t))
210
- }), Me = (e, ...t) => ({
211
- bg: e,
212
- instances: t.map((e, t) => Ae(e, t))
213
- }), V = [
214
- {
215
- id: "sunburst",
216
- label: "Sunburst",
217
- sub: "Radial",
218
- comp: z({
219
- text: "Without a soul, is it a place?",
220
- fontSize: 26,
221
- vf: {
222
- wdth: 100,
223
- wght: 500
224
- },
225
- path: {
226
- type: "radial",
227
- count: 14,
228
- inner: .1,
229
- spin: 1
230
- }
231
- })
232
- },
233
- {
234
- id: "dense-burst",
235
- label: "Dense burst",
236
- sub: "Radial",
237
- comp: z({
238
- text: "is it a place",
239
- fontSize: 30,
240
- vf: {
241
- wdth: 90,
242
- wght: 600
243
- },
244
- path: {
245
- type: "radial",
246
- count: 28,
247
- inner: .06,
248
- spin: 1
249
- }
250
- })
251
- },
252
- {
253
- id: "double-twirl",
254
- label: "Double twirl",
255
- sub: "Radial",
256
- comp: z({
257
- text: "turning and turning",
258
- fontSize: 24,
259
- font: "malromur",
260
- vf: { wght: 500 },
261
- path: {
262
- type: "radial",
263
- count: 18,
264
- inner: .12,
265
- spin: 2
266
- }
267
- })
268
- },
269
- {
270
- id: "pulse-burst",
271
- label: "Pulse burst",
272
- sub: "Radial",
273
- comp: z({
274
- text: "breathe in, breathe out",
275
- fontSize: 26,
276
- font: "gullhamrar",
277
- vf: { wght: 600 },
278
- path: {
279
- type: "radial",
280
- count: 16,
281
- inner: .1,
282
- spin: 1
283
- },
284
- motion: {
285
- mode: "cascade",
286
- cycles: 2,
287
- phase: .5
288
- }
289
- })
290
- },
291
- {
292
- id: "vortex",
293
- label: "Vortex",
294
- sub: "Rings",
295
- comp: z({
296
- text: "Does a community make a place? ",
297
- fontSize: 24,
298
- vf: {
299
- wdth: 100,
300
- wght: 500
301
- },
302
- path: {
303
- type: "rings",
304
- count: 12,
305
- inner: .1,
306
- radius: .94,
307
- spin: 1,
308
- twist: .6,
309
- grow: .8
310
- }
311
- })
312
- },
313
- {
314
- id: "galaxy",
315
- label: "Galaxy",
316
- sub: "Rings",
317
- comp: z({
318
- text: "spiralling inward forever ",
319
- fontSize: 22,
320
- font: "malromur",
321
- vf: { wght: 500 },
322
- path: {
323
- type: "rings",
324
- count: 16,
325
- inner: .05,
326
- radius: .96,
327
- spin: 1,
328
- twist: 1.25,
329
- grow: .9
330
- }
331
- })
332
- },
333
- {
334
- id: "wide-rings",
335
- label: "Wide rings",
336
- sub: "Rings",
337
- comp: z({
338
- text: "around and around ",
339
- fontSize: 28,
340
- font: "gullhamrar",
341
- vf: { wght: 600 },
342
- path: {
343
- type: "rings",
344
- count: 8,
345
- inner: .18,
346
- radius: .92,
347
- spin: 1,
348
- twist: .3,
349
- grow: 1.2
350
- }
351
- })
352
- },
353
- {
354
- id: "orbit",
355
- label: "Orbit",
356
- sub: "Path",
357
- comp: z({
358
- text: "KOLKRABBI · REYKJAVIK · ",
359
- fontSize: 40,
360
- font: "malromur",
361
- vf: { wght: 500 },
362
- path: {
363
- type: "circle",
364
- radius: .82
365
- },
366
- motion: {
367
- mode: "orbit",
368
- cycles: 1
369
- }
370
- })
371
- },
372
- {
373
- id: "spiral",
374
- label: "Spiral",
375
- sub: "Path",
376
- comp: z({
377
- text: "into the spiral we go ",
378
- fontSize: 30,
379
- vf: {
380
- wdth: 100,
381
- wght: 500
382
- },
383
- path: {
384
- type: "spiral",
385
- turns: 4,
386
- radius: .95
387
- },
388
- motion: {
389
- mode: "march",
390
- cycles: 1
391
- }
392
- })
393
- },
394
- {
395
- id: "template",
396
- label: "Template",
397
- sub: "Path",
398
- comp: z({
399
- text: "Type here",
400
- fontSize: 160,
401
- vf: {
402
- wdth: 100,
403
- wght: 600
404
- }
405
- })
406
- },
407
- {
408
- id: "big-statement",
409
- label: "Flood",
410
- sub: "Scenes",
411
- comp: B({
412
- text: "BIG",
413
- font: "rot",
414
- fontSize: 220,
415
- vf: {
416
- wdth: 140,
417
- wght: 100
418
- },
419
- fill: "#c2502e",
420
- motion: {
421
- mode: "vfwave",
422
- axis: "wght",
423
- cycles: 1,
424
- phase: .5
425
- }
426
- })
427
- },
428
- {
429
- id: "ring-and-word",
430
- label: "Ring",
431
- sub: "Scenes",
432
- comp: B({
433
- id: "a",
434
- text: "KOLKRABBI · REYKJAVIK · ",
435
- font: "malromur",
436
- fontSize: 56,
437
- vf: { wght: 500 },
438
- fill: "#9ec1ff",
439
- path: {
440
- type: "circle",
441
- radius: .86
442
- },
443
- motion: {
444
- mode: "orbit",
445
- cycles: 1
446
- }
447
- }, {
448
- id: "b",
449
- text: "KOL",
450
- font: "gullhamrar",
451
- fontSize: 180,
452
- vf: { wght: 800 },
453
- fill: "#e8e4dc",
454
- path: { type: "line" }
455
- })
456
- },
457
- {
458
- id: "custom-s",
459
- label: "Flow",
460
- sub: "Scenes",
461
- comp: B({
462
- text: "freeform",
463
- fontSize: 96,
464
- vf: { wght: 600 },
465
- path: { type: "custom" },
466
- showPath: !0
467
- })
468
- },
469
- {
470
- id: "malromur-wave",
471
- label: "Morph",
472
- sub: "Scenes",
473
- comp: B({
474
- text: "Malromur",
475
- font: "malromur",
476
- fontSize: 132,
477
- vf: { wght: 300 },
478
- motion: {
479
- mode: "vfwave",
480
- axis: "wght",
481
- cycles: 2,
482
- phase: .5
483
- }
484
- })
485
- },
486
- {
487
- id: "flag",
488
- label: "Wave",
489
- sub: "Scenes",
490
- comp: B({
491
- text: "flag",
492
- font: "rot",
493
- fontSize: 168,
494
- vf: {
495
- wdth: 120,
496
- wght: 600
497
- },
498
- motion: {
499
- mode: "glyphwave",
500
- cycles: 1,
501
- phase: .5,
502
- amp: .5
503
- }
504
- })
505
- },
506
- {
507
- id: "sweep-grid",
508
- label: "Reveal",
509
- sub: "Scenes",
510
- comp: B({
511
- text: "KOL",
512
- font: "rot",
513
- fontSize: 56,
514
- vf: {
515
- wdth: 90,
516
- wght: 500
517
- },
518
- fill: "#7fd1ff",
519
- path: {
520
- type: "array",
521
- rows: 4,
522
- cols: 5
523
- },
524
- motion: {
525
- mode: "sweep",
526
- field: "diagonal",
527
- cycles: 1,
528
- amp: .3
529
- }
530
- })
531
- },
532
- {
533
- id: "baseline",
534
- label: "Baseline",
535
- sub: "Elements",
536
- comp: B({
537
- text: "Typography",
538
- fontSize: 120,
539
- vf: { wght: 500 }
540
- })
541
- },
542
- {
543
- id: "arc-kinetic",
544
- label: "Arcs",
545
- sub: "Elements",
546
- comp: B({
547
- text: "Kinetic",
548
- fontSize: 130,
549
- vf: { wght: 600 },
550
- path: {
551
- type: "arc",
552
- amp: .45
553
- }
554
- })
555
- },
556
- {
557
- id: "ellipse-loop",
558
- label: "Loops",
559
- sub: "Elements",
560
- comp: B({
561
- text: "REYKJAVIK",
562
- font: "rot",
563
- fontSize: 78,
564
- vf: {
565
- wdth: 120,
566
- wght: 600
567
- },
568
- path: {
569
- type: "ellipse",
570
- radius: .92
571
- },
572
- motion: { mode: "orbit" }
573
- })
574
- },
575
- {
576
- id: "zigzag",
577
- label: "Angular",
578
- sub: "Elements",
579
- comp: B({
580
- text: "ZIGZAG",
581
- font: "malromur",
582
- fontSize: 92,
583
- vf: { wght: 700 },
584
- path: {
585
- type: "zigzag",
586
- amp: .5,
587
- freq: 3
588
- }
589
- })
590
- },
591
- {
592
- id: "array-grid",
593
- label: "Grid",
594
- sub: "Elements",
595
- comp: B({
596
- text: "KOL",
597
- fontSize: 64,
598
- vf: { wght: 600 },
599
- path: {
600
- type: "array",
601
- rows: 3,
602
- cols: 4
603
- }
604
- })
605
- },
606
- {
607
- id: "weight-pulse",
608
- label: "Weight",
609
- sub: "Elements",
610
- comp: B({
611
- text: "WEIGHT",
612
- fontSize: 150,
613
- vf: { wght: 300 },
614
- motion: {
615
- mode: "vfwave",
616
- axis: "wght",
617
- cycles: 1,
618
- phase: .6
619
- }
620
- })
621
- },
622
- {
623
- id: "rot-width",
624
- label: "Width",
625
- sub: "Elements",
626
- comp: B({
627
- text: "WIDTH",
628
- font: "rot",
629
- fontSize: 150,
630
- vf: {
631
- wdth: 64,
632
- wght: 600
633
- },
634
- motion: {
635
- mode: "vfwave",
636
- axis: "wdth",
637
- cycles: 1,
638
- phase: .6
639
- }
640
- })
641
- },
642
- {
643
- id: "cascade",
644
- label: "Cascade",
645
- sub: "Elements",
646
- comp: B({
647
- text: "CASCADE",
648
- fontSize: 130,
649
- vf: { wght: 600 },
650
- motion: {
651
- mode: "cascade",
652
- cycles: 1,
653
- phase: .6
654
- }
655
- })
656
- },
657
- {
658
- id: "baseline-mono",
659
- label: "Mono line",
660
- sub: "Lines",
661
- comp: B({
662
- text: "monospace",
663
- font: "rot",
664
- fontSize: 110,
665
- vf: {
666
- wdth: 90,
667
- wght: 500
668
- },
669
- fill: "#7fd1ff"
670
- })
671
- },
672
- {
673
- id: "baseline-light",
674
- label: "On paper",
675
- sub: "Lines",
676
- comp: Me("#f4f1ea", {
677
- text: "Reykjavik",
678
- font: "malromur",
679
- fontSize: 130,
680
- vf: { wght: 600 },
681
- fill: "#0b0b0e"
682
- })
683
- },
684
- {
685
- id: "sine-flow",
686
- label: "Sine flow",
687
- sub: "Curves",
688
- comp: B({
689
- text: "wave along",
690
- font: "rot",
691
- fontSize: 96,
692
- vf: {
693
- wdth: 90,
694
- wght: 500
695
- },
696
- path: {
697
- type: "sine",
698
- amp: .4,
699
- freq: 2
700
- },
701
- motion: {
702
- mode: "march",
703
- cycles: 1
704
- }
705
- })
706
- },
707
- {
708
- id: "spiral-in",
709
- label: "Spiral",
710
- sub: "Curves",
711
- comp: B({
712
- text: "spiral",
713
- fontSize: 88,
714
- vf: { wght: 700 },
715
- path: {
716
- type: "spiral",
717
- turns: 3
718
- }
719
- })
720
- },
721
- {
722
- id: "arc-march",
723
- label: "Arc march",
724
- sub: "Curves",
725
- comp: B({
726
- text: "on the arc",
727
- font: "rot",
728
- fontSize: 96,
729
- vf: {
730
- wdth: 100,
731
- wght: 500
732
- },
733
- path: {
734
- type: "arc",
735
- amp: .5
736
- },
737
- motion: { mode: "march" }
738
- })
739
- },
740
- {
741
- id: "arc-up",
742
- label: "High arc",
743
- sub: "Curves",
744
- comp: B({
745
- text: "over the top",
746
- font: "malromur",
747
- fontSize: 92,
748
- vf: { wght: 600 },
749
- path: {
750
- type: "arc",
751
- amp: .7
752
- }
753
- })
754
- },
755
- {
756
- id: "arc-wide",
757
- label: "Wide arc",
758
- sub: "Curves",
759
- comp: B({
760
- text: "WIDEARC",
761
- font: "rot",
762
- fontSize: 96,
763
- vf: {
764
- wdth: 150,
765
- wght: 600
766
- },
767
- path: {
768
- type: "arc",
769
- amp: .4
770
- }
771
- })
772
- },
773
- {
774
- id: "sine-fast",
775
- label: "Fast wave",
776
- sub: "Curves",
777
- comp: B({
778
- text: "up and down",
779
- fontSize: 90,
780
- vf: { wght: 600 },
781
- path: {
782
- type: "sine",
783
- amp: .4,
784
- freq: 3
785
- },
786
- motion: {
787
- mode: "march",
788
- cycles: 2
789
- }
790
- })
791
- },
792
- {
793
- id: "sine-tall",
794
- label: "Tall wave",
795
- sub: "Curves",
796
- comp: B({
797
- text: "rolling",
798
- font: "rot",
799
- fontSize: 100,
800
- vf: {
801
- wdth: 90,
802
- wght: 500
803
- },
804
- path: {
805
- type: "sine",
806
- amp: .6,
807
- freq: 2
808
- }
809
- })
810
- },
811
- {
812
- id: "spiral-march",
813
- label: "Spiral march",
814
- sub: "Curves",
815
- comp: B({
816
- text: "into the spiral",
817
- font: "rot",
818
- fontSize: 72,
819
- vf: {
820
- wdth: 100,
821
- wght: 500
822
- },
823
- path: {
824
- type: "spiral",
825
- turns: 5
826
- },
827
- motion: {
828
- mode: "march",
829
- cycles: 1
830
- }
831
- })
832
- },
833
- {
834
- id: "circle-orbit",
835
- label: "Circle",
836
- sub: "Closed",
837
- comp: B({
838
- text: "KOLKRABBI",
839
- font: "malromur",
840
- fontSize: 80,
841
- vf: { wght: 500 },
842
- path: {
843
- type: "circle",
844
- radius: .72
845
- },
846
- motion: {
847
- mode: "orbit",
848
- cycles: 1
849
- }
850
- })
851
- },
852
- {
853
- id: "circle-big",
854
- label: "Big circle",
855
- sub: "Closed",
856
- comp: B({
857
- text: "AROUND WE GO",
858
- fontSize: 76,
859
- vf: { wght: 600 },
860
- path: {
861
- type: "circle",
862
- radius: .85
863
- },
864
- motion: { mode: "orbit" }
865
- })
866
- },
867
- {
868
- id: "circle-mono",
869
- label: "Mono circle",
870
- sub: "Closed",
871
- comp: B({
872
- text: "LOOP/LOOP/",
873
- font: "rot",
874
- fontSize: 72,
875
- vf: {
876
- wdth: 90,
877
- wght: 500
878
- },
879
- fill: "#f6c453",
880
- path: {
881
- type: "circle",
882
- radius: .78
883
- },
884
- motion: { mode: "orbit" }
885
- })
886
- },
887
- {
888
- id: "ellipse-wide",
889
- label: "Wide ellipse",
890
- sub: "Closed",
891
- comp: B({
892
- text: "ELLIPTICAL",
893
- font: "malromur",
894
- fontSize: 74,
895
- vf: { wght: 500 },
896
- path: {
897
- type: "ellipse",
898
- radius: 1
899
- },
900
- motion: { mode: "orbit" }
901
- })
902
- },
903
- {
904
- id: "zigzag-fine",
905
- label: "Fine zigzag",
906
- sub: "Angular",
907
- comp: B({
908
- text: "sawtooth",
909
- font: "rot",
910
- fontSize: 80,
911
- vf: {
912
- wdth: 90,
913
- wght: 600
914
- },
915
- path: {
916
- type: "zigzag",
917
- amp: .35,
918
- freq: 5
919
- }
920
- })
921
- },
922
- {
923
- id: "custom-march",
924
- label: "Custom march",
925
- sub: "Custom",
926
- comp: B({
927
- text: "follow me",
928
- font: "rot",
929
- fontSize: 90,
930
- vf: {
931
- wdth: 90,
932
- wght: 500
933
- },
934
- path: { type: "custom" },
935
- motion: { mode: "march" }
936
- })
937
- },
938
- {
939
- id: "ordspor-pulse",
940
- label: "Ordspor",
941
- sub: "Weight",
942
- comp: B({
943
- text: "Ordspor",
944
- font: "rot",
945
- fontSize: 132,
946
- vf: {
947
- wdth: 90,
948
- wght: 300
949
- },
950
- motion: {
951
- mode: "vfwave",
952
- axis: "wght",
953
- cycles: 1,
954
- phase: .7
955
- }
956
- })
957
- },
958
- {
959
- id: "rot-weight",
960
- label: "Rot weight",
961
- sub: "Weight",
962
- comp: B({
963
- text: "ROT",
964
- font: "rot",
965
- fontSize: 200,
966
- vf: {
967
- wdth: 120,
968
- wght: 100
969
- },
970
- motion: {
971
- mode: "vfwave",
972
- axis: "wght",
973
- cycles: 1,
974
- phase: .5
975
- }
976
- })
977
- },
978
- {
979
- id: "weight-slow",
980
- label: "Slow weight",
981
- sub: "Weight",
982
- comp: B({
983
- text: "breathe",
984
- fontSize: 150,
985
- vf: { wght: 300 },
986
- motion: {
987
- mode: "vfwave",
988
- axis: "wght",
989
- cycles: 1,
990
- phase: .3
991
- }
992
- })
993
- },
994
- {
995
- id: "weight-fast",
996
- label: "Fast weight",
997
- sub: "Weight",
998
- comp: B({
999
- text: "PULSE",
1000
- fontSize: 160,
1001
- vf: { wght: 300 },
1002
- motion: {
1003
- mode: "vfwave",
1004
- axis: "wght",
1005
- cycles: 3,
1006
- phase: .6
1007
- }
1008
- })
1009
- },
1010
- {
1011
- id: "malromur-heavy",
1012
- label: "Heavy swing",
1013
- sub: "Weight",
1014
- comp: Me("#f4f1ea", {
1015
- text: "Malromur",
1016
- font: "malromur",
1017
- fontSize: 130,
1018
- vf: { wght: 300 },
1019
- fill: "#0b0b0e",
1020
- motion: {
1021
- mode: "vfwave",
1022
- axis: "wght",
1023
- cycles: 1,
1024
- phase: .5
1025
- }
1026
- })
1027
- },
1028
- {
1029
- id: "ordspor-wave2",
1030
- label: "Ordspor ×2",
1031
- sub: "Weight",
1032
- comp: B({
1033
- text: "twice",
1034
- font: "rot",
1035
- fontSize: 150,
1036
- vf: {
1037
- wdth: 90,
1038
- wght: 300
1039
- },
1040
- motion: {
1041
- mode: "vfwave",
1042
- axis: "wght",
1043
- cycles: 2,
1044
- phase: .5
1045
- }
1046
- })
1047
- },
1048
- {
1049
- id: "rot-weight2",
1050
- label: "Rot weight ×2",
1051
- sub: "Weight",
1052
- comp: B({
1053
- text: "ROT",
1054
- font: "rot",
1055
- fontSize: 200,
1056
- vf: {
1057
- wdth: 120,
1058
- wght: 100
1059
- },
1060
- motion: {
1061
- mode: "vfwave",
1062
- axis: "wght",
1063
- cycles: 2,
1064
- phase: .4
1065
- }
1066
- })
1067
- },
1068
- {
1069
- id: "malromur-bigwave",
1070
- label: "Big wave",
1071
- sub: "Weight",
1072
- comp: B({
1073
- text: "WEIGHT",
1074
- font: "malromur",
1075
- fontSize: 150,
1076
- vf: { wght: 300 },
1077
- fill: "#f6c453",
1078
- motion: {
1079
- mode: "vfwave",
1080
- axis: "wght",
1081
- cycles: 2,
1082
- phase: .7
1083
- }
1084
- })
1085
- },
1086
- {
1087
- id: "ordspor-accent",
1088
- label: "Ordspor accent",
1089
- sub: "Weight",
1090
- comp: B({
1091
- text: "Ordspor",
1092
- font: "rot",
1093
- fontSize: 140,
1094
- vf: {
1095
- wdth: 90,
1096
- wght: 300
1097
- },
1098
- fill: "#8f5ad0",
1099
- motion: {
1100
- mode: "vfwave",
1101
- axis: "wght",
1102
- cycles: 1,
1103
- phase: .6
1104
- }
1105
- })
1106
- },
1107
- {
1108
- id: "rot-dual",
1109
- label: "Variable",
1110
- sub: "Width",
1111
- comp: B({
1112
- text: "variable",
1113
- font: "rot",
1114
- fontSize: 124,
1115
- vf: {
1116
- wdth: 100,
1117
- wght: 400
1118
- },
1119
- motion: {
1120
- mode: "vfwave",
1121
- axis: "wdth",
1122
- cycles: 2,
1123
- phase: .4
1124
- }
1125
- })
1126
- },
1127
- {
1128
- id: "rot-width-fast",
1129
- label: "Width ×2",
1130
- sub: "Width",
1131
- comp: B({
1132
- text: "STRETCH",
1133
- font: "rot",
1134
- fontSize: 130,
1135
- vf: {
1136
- wdth: 64,
1137
- wght: 600
1138
- },
1139
- motion: {
1140
- mode: "vfwave",
1141
- axis: "wdth",
1142
- cycles: 2,
1143
- phase: .5
1144
- }
1145
- })
1146
- },
1147
- {
1148
- id: "rot-width-slow",
1149
- label: "Width slow",
1150
- sub: "Width",
1151
- comp: B({
1152
- text: "expand",
1153
- font: "rot",
1154
- fontSize: 130,
1155
- vf: {
1156
- wdth: 100,
1157
- wght: 500
1158
- },
1159
- motion: {
1160
- mode: "vfwave",
1161
- axis: "wdth",
1162
- cycles: 1,
1163
- phase: .3
1164
- }
1165
- })
1166
- },
1167
- {
1168
- id: "morph-mtl",
1169
- label: "Made to last",
1170
- sub: "Morph",
1171
- comp: B({
1172
- text: "Made to last",
1173
- font: "rot",
1174
- fontSize: 150,
1175
- vf: {
1176
- wdth: 64,
1177
- wght: 100
1178
- },
1179
- morph: {
1180
- on: !0,
1181
- mode: "morph",
1182
- curve: "linear",
1183
- blend: .5,
1184
- vf2: {
1185
- wdth: 172,
1186
- wght: 900
1187
- }
1188
- }
1189
- })
1190
- },
1191
- {
1192
- id: "morph-wave",
1193
- label: "Morph wave",
1194
- sub: "Morph",
1195
- comp: B({
1196
- text: "MORPH",
1197
- font: "rot",
1198
- fontSize: 200,
1199
- vf: {
1200
- wdth: 64,
1201
- wght: 200
1202
- },
1203
- morph: {
1204
- on: !0,
1205
- mode: "morph",
1206
- curve: "sine",
1207
- blend: .5,
1208
- vf2: {
1209
- wdth: 172,
1210
- wght: 900
1211
- }
1212
- }
1213
- })
1214
- },
1215
- {
1216
- id: "morph-ease",
1217
- label: "Heavy → light",
1218
- sub: "Morph",
1219
- comp: B({
1220
- text: "gradient",
1221
- font: "rot",
1222
- fontSize: 150,
1223
- vf: {
1224
- wdth: 120,
1225
- wght: 900
1226
- },
1227
- morph: {
1228
- on: !0,
1229
- mode: "morph",
1230
- curve: "ease",
1231
- blend: .5,
1232
- vf2: {
1233
- wdth: 120,
1234
- wght: 100
1235
- }
1236
- }
1237
- })
1238
- },
1239
- {
1240
- id: "morph-random",
1241
- label: "Ransom note",
1242
- sub: "Morph",
1243
- comp: B({
1244
- text: "CHAOS",
1245
- font: "rot",
1246
- fontSize: 170,
1247
- vf: {
1248
- wdth: 100,
1249
- wght: 500
1250
- },
1251
- morph: {
1252
- on: !0,
1253
- mode: "random",
1254
- blend: .37
1255
- }
1256
- })
1257
- },
1258
- {
1259
- id: "morph-fade",
1260
- label: "Fade A↔B",
1261
- sub: "Morph",
1262
- comp: B({
1263
- text: "between",
1264
- font: "gullhamrar",
1265
- fontSize: 150,
1266
- vf: { wght: 300 },
1267
- morph: {
1268
- on: !0,
1269
- mode: "fade",
1270
- blend: .5,
1271
- vf2: { wght: 900 }
1272
- }
1273
- })
1274
- },
1275
- {
1276
- id: "morph-cross",
1277
- label: "Cross-face",
1278
- sub: "Morph",
1279
- comp: B({
1280
- text: "hybrid",
1281
- font: "rot",
1282
- fontSize: 150,
1283
- vf: {
1284
- wdth: 100,
1285
- wght: 600
1286
- },
1287
- morph: {
1288
- on: !0,
1289
- mode: "morph",
1290
- blend: .5,
1291
- face2: "gullhamrar"
1292
- }
1293
- })
1294
- },
1295
- {
1296
- id: "arc-weight",
1297
- label: "Morph on arc",
1298
- sub: "On path",
1299
- comp: B({
1300
- text: "morph",
1301
- fontSize: 120,
1302
- path: {
1303
- type: "arc",
1304
- amp: .3
1305
- },
1306
- motion: {
1307
- mode: "vfwave",
1308
- axis: "wght",
1309
- cycles: 1,
1310
- phase: .6
1311
- }
1312
- })
1313
- },
1314
- {
1315
- id: "sine-weight",
1316
- label: "Wave + weight",
1317
- sub: "On path",
1318
- comp: B({
1319
- text: "modulated",
1320
- fontSize: 92,
1321
- vf: { wght: 400 },
1322
- path: {
1323
- type: "sine",
1324
- amp: .3,
1325
- freq: 2
1326
- },
1327
- motion: {
1328
- mode: "vfwave",
1329
- axis: "wght",
1330
- cycles: 1,
1331
- phase: .5
1332
- }
1333
- })
1334
- },
1335
- {
1336
- id: "circle-weight",
1337
- label: "Ring + weight",
1338
- sub: "On path",
1339
- comp: B({
1340
- text: "ROTATING",
1341
- font: "malromur",
1342
- fontSize: 78,
1343
- vf: { wght: 300 },
1344
- path: {
1345
- type: "circle",
1346
- radius: .74
1347
- },
1348
- motion: {
1349
- mode: "vfwave",
1350
- axis: "wght",
1351
- cycles: 2,
1352
- phase: .6
1353
- }
1354
- })
1355
- },
1356
- {
1357
- id: "arc-width",
1358
- label: "Arc + width",
1359
- sub: "On path",
1360
- comp: B({
1361
- text: "arcwidth",
1362
- font: "rot",
1363
- fontSize: 96,
1364
- vf: {
1365
- wdth: 80,
1366
- wght: 600
1367
- },
1368
- path: {
1369
- type: "arc",
1370
- amp: .4
1371
- },
1372
- motion: {
1373
- mode: "vfwave",
1374
- axis: "wdth",
1375
- cycles: 1,
1376
- phase: .5
1377
- }
1378
- })
1379
- },
1380
- {
1381
- id: "pop",
1382
- label: "Pop",
1383
- sub: "Reveal",
1384
- comp: B({
1385
- text: "POP POP",
1386
- fontSize: 130,
1387
- vf: { wght: 800 },
1388
- motion: {
1389
- mode: "cascade",
1390
- cycles: 2,
1391
- phase: .8
1392
- }
1393
- })
1394
- },
1395
- {
1396
- id: "arc-cascade",
1397
- label: "Curve cascade",
1398
- sub: "Reveal",
1399
- comp: B({
1400
- text: "on a curve",
1401
- font: "rot",
1402
- fontSize: 100,
1403
- vf: {
1404
- wdth: 90,
1405
- wght: 500
1406
- },
1407
- path: {
1408
- type: "arc",
1409
- amp: .4
1410
- },
1411
- motion: {
1412
- mode: "cascade",
1413
- cycles: 1,
1414
- phase: .5
1415
- }
1416
- })
1417
- },
1418
- {
1419
- id: "cascade-slow",
1420
- label: "Slow cascade",
1421
- sub: "Reveal",
1422
- comp: B({
1423
- text: "unfold",
1424
- fontSize: 130,
1425
- vf: { wght: 600 },
1426
- motion: {
1427
- mode: "cascade",
1428
- cycles: 1,
1429
- phase: .4
1430
- }
1431
- })
1432
- },
1433
- {
1434
- id: "cascade-fast",
1435
- label: "Fast cascade",
1436
- sub: "Reveal",
1437
- comp: B({
1438
- text: "flicker",
1439
- fontSize: 130,
1440
- vf: { wght: 700 },
1441
- motion: {
1442
- mode: "cascade",
1443
- cycles: 2,
1444
- phase: .7
1445
- }
1446
- })
1447
- },
1448
- {
1449
- id: "typewriter",
1450
- label: "Typewriter",
1451
- sub: "Reveal",
1452
- comp: B({
1453
- text: "type_type_",
1454
- font: "rot",
1455
- fontSize: 100,
1456
- vf: {
1457
- wdth: 90,
1458
- wght: 500
1459
- },
1460
- fill: "#7fd1ff",
1461
- motion: {
1462
- mode: "cascade",
1463
- cycles: 1,
1464
- phase: 1
1465
- }
1466
- })
1467
- },
1468
- {
1469
- id: "spiral-cascade",
1470
- label: "Spiral reveal",
1471
- sub: "Reveal",
1472
- comp: B({
1473
- text: "spiral down",
1474
- fontSize: 74,
1475
- vf: { wght: 600 },
1476
- path: {
1477
- type: "spiral",
1478
- turns: 3
1479
- },
1480
- motion: {
1481
- mode: "cascade",
1482
- cycles: 1,
1483
- phase: .5
1484
- }
1485
- })
1486
- },
1487
- {
1488
- id: "circle-cascade",
1489
- label: "Ring reveal",
1490
- sub: "Reveal",
1491
- comp: B({
1492
- text: "AROUND",
1493
- font: "malromur",
1494
- fontSize: 86,
1495
- vf: { wght: 600 },
1496
- path: {
1497
- type: "circle",
1498
- radius: .74
1499
- },
1500
- motion: {
1501
- mode: "cascade",
1502
- cycles: 1,
1503
- phase: .6
1504
- }
1505
- })
1506
- },
1507
- {
1508
- id: "pop-mono",
1509
- label: "Mono pop",
1510
- sub: "Reveal",
1511
- comp: B({
1512
- text: "POP.POP.",
1513
- font: "rot",
1514
- fontSize: 110,
1515
- vf: {
1516
- wdth: 90,
1517
- wght: 500
1518
- },
1519
- fill: "#f6c453",
1520
- motion: {
1521
- mode: "cascade",
1522
- cycles: 2,
1523
- phase: .8
1524
- }
1525
- })
1526
- },
1527
- {
1528
- id: "glyph-wave",
1529
- label: "Ripple",
1530
- sub: "Wave",
1531
- comp: B({
1532
- text: "ripple",
1533
- font: "malromur",
1534
- fontSize: 140,
1535
- vf: { wght: 600 },
1536
- motion: {
1537
- mode: "glyphwave",
1538
- cycles: 1,
1539
- phase: .6,
1540
- amp: .4
1541
- }
1542
- })
1543
- },
1544
- {
1545
- id: "sine-ripple",
1546
- label: "Sine ripple",
1547
- sub: "Wave",
1548
- comp: B({
1549
- text: "wavewave",
1550
- font: "rot",
1551
- fontSize: 108,
1552
- vf: {
1553
- wdth: 110,
1554
- wght: 600
1555
- },
1556
- path: {
1557
- type: "sine",
1558
- amp: .3,
1559
- freq: 2
1560
- },
1561
- motion: {
1562
- mode: "glyphwave",
1563
- amp: .3
1564
- }
1565
- })
1566
- },
1567
- {
1568
- id: "glyph-big",
1569
- label: "Big ripple",
1570
- sub: "Wave",
1571
- comp: B({
1572
- text: "WAVES",
1573
- fontSize: 150,
1574
- vf: { wght: 700 },
1575
- motion: {
1576
- mode: "glyphwave",
1577
- cycles: 1,
1578
- phase: .6,
1579
- amp: .6
1580
- }
1581
- })
1582
- },
1583
- {
1584
- id: "glyph-fast",
1585
- label: "Fast ripple",
1586
- sub: "Wave",
1587
- comp: B({
1588
- text: "shiver",
1589
- font: "malromur",
1590
- fontSize: 140,
1591
- vf: { wght: 600 },
1592
- motion: {
1593
- mode: "glyphwave",
1594
- cycles: 2,
1595
- phase: .5,
1596
- amp: .35
1597
- }
1598
- })
1599
- },
1600
- {
1601
- id: "arc-glyphwave",
1602
- label: "Arc ripple",
1603
- sub: "Wave",
1604
- comp: B({
1605
- text: "on a curve",
1606
- font: "rot",
1607
- fontSize: 96,
1608
- vf: {
1609
- wdth: 90,
1610
- wght: 500
1611
- },
1612
- path: {
1613
- type: "arc",
1614
- amp: .4
1615
- },
1616
- motion: {
1617
- mode: "glyphwave",
1618
- amp: .3
1619
- }
1620
- })
1621
- },
1622
- {
1623
- id: "rot-flag-fast",
1624
- label: "Rot flag",
1625
- sub: "Wave",
1626
- comp: B({
1627
- text: "flutter",
1628
- font: "rot",
1629
- fontSize: 150,
1630
- vf: {
1631
- wdth: 120,
1632
- wght: 600
1633
- },
1634
- motion: {
1635
- mode: "glyphwave",
1636
- cycles: 2,
1637
- phase: .5,
1638
- amp: .5
1639
- }
1640
- })
1641
- },
1642
- {
1643
- id: "sine-ripple2",
1644
- label: "Sine flutter",
1645
- sub: "Wave",
1646
- comp: B({
1647
- text: "flowflow",
1648
- font: "rot",
1649
- fontSize: 100,
1650
- vf: {
1651
- wdth: 90,
1652
- wght: 500
1653
- },
1654
- path: {
1655
- type: "sine",
1656
- amp: .3,
1657
- freq: 2
1658
- },
1659
- motion: {
1660
- mode: "glyphwave",
1661
- cycles: 2,
1662
- amp: .3
1663
- }
1664
- })
1665
- },
1666
- {
1667
- id: "sweep-x",
1668
- label: "Sweep X",
1669
- sub: "Sweep",
1670
- comp: B({
1671
- text: "SWEEP",
1672
- fontSize: 150,
1673
- vf: { wght: 700 },
1674
- motion: {
1675
- mode: "sweep",
1676
- field: "x",
1677
- cycles: 1,
1678
- amp: .3
1679
- }
1680
- })
1681
- },
1682
- {
1683
- id: "sweep-y",
1684
- label: "Sweep Y",
1685
- sub: "Sweep",
1686
- comp: B({
1687
- text: "descend",
1688
- font: "rot",
1689
- fontSize: 130,
1690
- vf: {
1691
- wdth: 90,
1692
- wght: 500
1693
- },
1694
- motion: {
1695
- mode: "sweep",
1696
- field: "y",
1697
- cycles: 1,
1698
- amp: .35
1699
- }
1700
- })
1701
- },
1702
- {
1703
- id: "sweep-radial",
1704
- label: "Radial pulse",
1705
- sub: "Sweep",
1706
- comp: B({
1707
- text: "PULSE",
1708
- font: "malromur",
1709
- fontSize: 140,
1710
- vf: { wght: 600 },
1711
- motion: {
1712
- mode: "sweep",
1713
- field: "radial",
1714
- cycles: 1,
1715
- amp: .4
1716
- }
1717
- })
1718
- },
1719
- {
1720
- id: "sweep-weight",
1721
- label: "Sweep weight",
1722
- sub: "Sweep",
1723
- comp: B({
1724
- text: "WEIGHT",
1725
- fontSize: 150,
1726
- vf: { wght: 300 },
1727
- motion: {
1728
- mode: "sweepWeight",
1729
- field: "x",
1730
- cycles: 1,
1731
- amp: .4
1732
- }
1733
- })
1734
- },
1735
- {
1736
- id: "sweep-shift",
1737
- label: "Sweep shift",
1738
- sub: "Sweep",
1739
- comp: B({
1740
- text: "shiver",
1741
- font: "rot",
1742
- fontSize: 130,
1743
- vf: {
1744
- wdth: 110,
1745
- wght: 600
1746
- },
1747
- motion: {
1748
- mode: "sweepShift",
1749
- field: "wave",
1750
- cycles: 1,
1751
- amp: .3
1752
- }
1753
- })
1754
- },
1755
- {
1756
- id: "orbit-spin",
1757
- label: "Orbit",
1758
- sub: "Orbit",
1759
- comp: B({
1760
- text: "ORBIT",
1761
- font: "malromur",
1762
- fontSize: 88,
1763
- vf: { wght: 600 },
1764
- path: {
1765
- type: "circle",
1766
- radius: .7
1767
- },
1768
- motion: {
1769
- mode: "orbit",
1770
- cycles: 1
1771
- }
1772
- })
1773
- },
1774
- {
1775
- id: "orbit-fast",
1776
- label: "Fast orbit",
1777
- sub: "Orbit",
1778
- comp: B({
1779
- text: "spinning",
1780
- fontSize: 84,
1781
- vf: { wght: 600 },
1782
- path: {
1783
- type: "circle",
1784
- radius: .72
1785
- },
1786
- motion: {
1787
- mode: "orbit",
1788
- cycles: 2
1789
- }
1790
- })
1791
- },
1792
- {
1793
- id: "ellipse-orbit",
1794
- label: "Ellipse orbit",
1795
- sub: "Orbit",
1796
- comp: B({
1797
- text: "ORBITAL",
1798
- font: "rot",
1799
- fontSize: 78,
1800
- vf: {
1801
- wdth: 110,
1802
- wght: 600
1803
- },
1804
- path: {
1805
- type: "ellipse",
1806
- radius: .95
1807
- },
1808
- motion: {
1809
- mode: "orbit",
1810
- cycles: 1
1811
- }
1812
- })
1813
- },
1814
- {
1815
- id: "array-pulse",
1816
- label: "Grid pulse",
1817
- sub: "Array",
1818
- comp: B({
1819
- text: "NODE",
1820
- font: "rot",
1821
- fontSize: 44,
1822
- vf: {
1823
- wdth: 90,
1824
- wght: 500
1825
- },
1826
- fill: "#7fd1ff",
1827
- path: {
1828
- type: "array",
1829
- rows: 4,
1830
- cols: 5
1831
- },
1832
- motion: {
1833
- mode: "cascade",
1834
- cycles: 1,
1835
- phase: .5
1836
- }
1837
- })
1838
- },
1839
- {
1840
- id: "array-wave",
1841
- label: "Grid wave",
1842
- sub: "Array",
1843
- comp: B({
1844
- text: "echo",
1845
- font: "rot",
1846
- fontSize: 52,
1847
- vf: {
1848
- wdth: 90,
1849
- wght: 500
1850
- },
1851
- path: {
1852
- type: "array",
1853
- rows: 3,
1854
- cols: 3
1855
- },
1856
- motion: {
1857
- mode: "glyphwave",
1858
- cycles: 1,
1859
- phase: .7,
1860
- amp: .4
1861
- }
1862
- })
1863
- },
1864
- {
1865
- id: "array-weight",
1866
- label: "Grid weight",
1867
- sub: "Array",
1868
- comp: B({
1869
- text: "OK",
1870
- font: "rot",
1871
- fontSize: 88,
1872
- vf: {
1873
- wdth: 100,
1874
- wght: 200
1875
- },
1876
- path: {
1877
- type: "array",
1878
- rows: 2,
1879
- cols: 3
1880
- },
1881
- motion: {
1882
- mode: "vfwave",
1883
- axis: "wght",
1884
- cycles: 1,
1885
- phase: .6
1886
- }
1887
- })
1888
- },
1889
- {
1890
- id: "stacked",
1891
- label: "Stacked",
1892
- sub: "Composite",
1893
- comp: B({
1894
- id: "a",
1895
- text: "KINETIC",
1896
- font: "gullhamrar",
1897
- fontSize: 130,
1898
- vf: { wght: 700 },
1899
- fill: "#e8e4dc",
1900
- path: {
1901
- type: "line",
1902
- offset: -.16
1903
- }
1904
- }, {
1905
- id: "b",
1906
- text: "typography",
1907
- font: "rot",
1908
- fontSize: 90,
1909
- vf: {
1910
- wdth: 90,
1911
- wght: 400
1912
- },
1913
- fill: "#f6c453",
1914
- path: {
1915
- type: "line",
1916
- offset: .16
1917
- },
1918
- motion: {
1919
- mode: "vfwave",
1920
- axis: "wght",
1921
- cycles: 1,
1922
- phase: .5
1923
- }
1924
- })
1925
- },
1926
- {
1927
- id: "grid-and-ring",
1928
- label: "Grid + ring",
1929
- sub: "Composite",
1930
- comp: Me("#0a0b14", {
1931
- id: "a",
1932
- text: "echo",
1933
- font: "rot",
1934
- fontSize: 40,
1935
- vf: {
1936
- wdth: 90,
1937
- wght: 500
1938
- },
1939
- fill: "#3a4a6a",
1940
- path: {
1941
- type: "array",
1942
- rows: 4,
1943
- cols: 5
1944
- }
1945
- }, {
1946
- id: "b",
1947
- text: "SIGNAL · SIGNAL · ",
1948
- font: "rot",
1949
- fontSize: 60,
1950
- vf: {
1951
- wdth: 110,
1952
- wght: 600
1953
- },
1954
- fill: "#9ec1ff",
1955
- path: {
1956
- type: "circle",
1957
- radius: .7
1958
- },
1959
- motion: {
1960
- mode: "orbit",
1961
- cycles: 1
1962
- }
1963
- })
1964
- }
1965
- ], Ne = (e) => V.find((t) => t.id === e) || V[0], Pe = [
1966
- "Radial",
1967
- "Rings",
1968
- "Path"
1969
- ], Fe = [{
1970
- label: "Type",
1971
- subs: Pe
1972
- }, {
1973
- label: "Kinetic",
1974
- subs: [...new Set(V.map((e) => e.sub))].filter((e) => !Pe.includes(e))
1975
- }], Ie = (e) => structuredClone(e.comp), H = {
1976
- dLen: 0,
1977
- dNormal: 0,
1978
- scale: 1,
1979
- dRot: 0,
1980
- opacity: 1,
1981
- vf: null
1982
- }, Le = {
1983
- none: () => H,
1984
- march: (e) => ({
1985
- ...H,
1986
- dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
1987
- }),
1988
- orbit: (e) => ({
1989
- ...H,
1990
- dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
1991
- }),
1992
- vfwave: (e) => {
1993
- let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * b * t - e.i * (e.m.phase ?? .5));
1994
- return {
1995
- ...H,
1996
- vf: { [e.axisTag]: E(e.axisMin, e.axisMax, n) }
1997
- };
1998
- },
1999
- glyphwave: (e) => {
2000
- let t = Math.max(1, Math.round(e.m.cycles || 1)), n = Math.sin(e.u * b * t - e.i * (e.m.phase ?? .5));
2001
- return {
2002
- ...H,
2003
- dNormal: (e.m.amp ?? .3) * e.sizePx * n
2004
- };
2005
- },
2006
- cascade: (e) => {
2007
- let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * b * t - e.i * (e.m.phase ?? .6));
2008
- return {
2009
- ...H,
2010
- scale: E(.25, 1, n),
2011
- opacity: E(.15, 1, n)
2012
- };
2013
- },
2014
- sweep: (e) => {
2015
- let t = Ve(e);
2016
- return {
2017
- ...H,
2018
- scale: E(.25, 1, t),
2019
- opacity: E(.12, 1, t)
2020
- };
2021
- },
2022
- sweepWeight: (e) => {
2023
- let t = Ve(e);
2024
- return {
2025
- ...H,
2026
- vf: { [e.axisTag]: E(e.axisMin, e.axisMax, t) }
2027
- };
2028
- },
2029
- sweepShift: (e) => {
2030
- let t = Ve(e);
2031
- return {
2032
- ...H,
2033
- dNormal: t * .6 * e.sizePx
2034
- };
2035
- }
2036
- }, Re = (e) => e - Math.floor(e);
2037
- function ze(e, t) {
2038
- if (t <= 0) return 0;
2039
- let n = Math.min(1, e / t);
2040
- return 1 - n * n * (3 - 2 * n);
2041
- }
2042
- function Be(e, t, n, r, i, a) {
2043
- let o = Re(r * i), s = Math.max(.02, a * .5), c = (e) => {
2044
- let t = Math.abs(Re(e) - o);
2045
- return ze(Math.min(t, 1 - t), s);
2046
- };
2047
- switch (e) {
2048
- case "y": return c(n);
2049
- case "diagonal": return c(.5 + (t - .5) * .7071 + (n - .5) * .7071);
2050
- case "radial": return c(Math.hypot(t - .5, n - .5) / .7071);
2051
- case "angular": return c(Math.atan2(n - .5, t - .5) / b + .5);
2052
- case "wave": {
2053
- let e = Math.max(1, Math.round(1 + (1 - a) * 6));
2054
- return .5 + .5 * Math.sin((t * e - r * i) * b);
2055
- }
2056
- default: return c(t);
2057
- }
2058
- }
2059
- var Ve = (e) => Be(e.m.field || "x", e.nx ?? .5, e.ny ?? .5, e.u, Math.max(1, Math.round(e.m.cycles || 1)), e.m.amp ?? .35);
2060
- function He(e, t) {
2061
- return (Le[e] || Le.none)(t);
2062
- }
2063
- //#endregion
2064
- //#region src/kinetic/features.js
2065
- var Ue = [
2066
- {
2067
- tag: "liga",
2068
- label: "Ligatures"
2069
- },
2070
- {
2071
- tag: "dlig",
2072
- label: "Discretionary ligatures"
2073
- },
2074
- {
2075
- tag: "smcp",
2076
- label: "Small caps"
2077
- },
2078
- {
2079
- tag: "case",
2080
- label: "Case-sensitive forms"
2081
- },
2082
- {
2083
- tag: "onum",
2084
- label: "Oldstyle figures"
2085
- },
2086
- {
2087
- tag: "tnum",
2088
- label: "Tabular figures"
2089
- },
2090
- {
2091
- tag: "frac",
2092
- label: "Fractions"
2093
- },
2094
- {
2095
- tag: "swsh",
2096
- label: "Swashes"
2097
- },
2098
- {
2099
- tag: "ss01",
2100
- label: "Stylistic set 1"
2101
- },
2102
- {
2103
- tag: "ss02",
2104
- label: "Stylistic set 2"
2105
- }
2106
- ];
2107
- function We(e) {
2108
- if (!e) return "normal";
2109
- let t = [];
2110
- for (let [n, r] of Object.entries(e)) t.push(`"${n}" ${+!!r}`);
2111
- return t.length ? t.join(", ") : "normal";
2112
- }
2113
- //#endregion
2114
- //#region src/kinetic/KineticType.js
2115
- var Ge = "http://www.w3.org/2000/svg", U = (e) => e - Math.floor(e), W = (e) => document.createElementNS(Ge, e);
2116
- function Ke(e, t) {
2117
- return !e || !t || t === "none" ? e || "" : t === "upper" ? e.toUpperCase() : t === "lower" ? e.toLowerCase() : t === "title" ? e.replace(/\b\w/g, (e) => e.toUpperCase()) : e;
2118
- }
2119
- function qe(e) {
2120
- if (!e) return {
2121
- bg: "#16202E",
2122
- instances: []
2123
- };
2124
- if (Array.isArray(e.instances)) return e;
2125
- let { bg: t, ...n } = e;
2126
- return {
2127
- bg: t || "#16202E",
2128
- instances: [{
2129
- id: "main",
2130
- ...n
2131
- }]
2132
- };
2133
- }
2134
- var Je = class {
2135
- constructor(e) {
2136
- this.host = e, this.params = qe(null), this.w = 0, this.h = 0, this._rt = /* @__PURE__ */ new Map(), this._instSig = "", this._needsRemeasure = !1;
2137
- let t = W("svg");
2138
- t.setAttribute("xmlns", Ge), t.style.display = "block", t.style.maxWidth = "100%", t.style.maxHeight = "100%", t.style.pointerEvents = "none", t.style.overflow = "hidden", this._clipApplied = !0, this.bg = W("rect"), this.layer = W("g"), this.measEl = W("text"), this.measEl.setAttribute("x", "0"), this.measEl.setAttribute("y", "0"), this.measEl.style.visibility = "hidden", t.append(this.bg, this.layer, this.measEl), e.appendChild(t), this.svg = t, e.__kolKineticEngine = this, typeof document < "u" && document.fonts && document.fonts.ready.then(() => {
2139
- this._needsRemeasure = !0;
2140
- }).catch(() => {});
2141
- }
2142
- resize(e, t) {
2143
- this.w = e, this.h = t, this.svg.setAttribute("width", e), this.svg.setAttribute("height", t), this.svg.setAttribute("viewBox", `0 0 ${e} ${t}`), this.bg.setAttribute("width", e), this.bg.setAttribute("height", t);
2144
- for (let e of this._rt.values()) e.cache = null;
2145
- }
2146
- setComposition(e) {
2147
- this.params = qe(e);
2148
- }
2149
- renderAt(e) {
2150
- !this.w || !this.h || this._render(g(e));
2151
- }
2152
- getInstanceRect(e) {
2153
- let t = this._rt.get(e);
2154
- if (!t || !t.glyphG) return null;
2155
- let n;
2156
- try {
2157
- n = t.glyphG.getBBox();
2158
- } catch {
2159
- return null;
2160
- }
2161
- if (!n || !n.width || !n.height) return null;
2162
- let r = (this.params.instances || []).find((t) => t.id === e), i = (r?.offset?.x || 0) * this.w, a = (r?.offset?.y || 0) * this.h;
2163
- return {
2164
- x: n.x + i,
2165
- y: n.y + a,
2166
- w: n.width,
2167
- h: n.height
2168
- };
2169
- }
2170
- hitTest(e, t) {
2171
- let n = this.svg.getBoundingClientRect();
2172
- if (!n.width || !n.height) return null;
2173
- let r = (e - n.left) * (this.w / n.width), i = (t - n.top) * (this.h / n.height), a = this.params.instances || [];
2174
- for (let e = a.length - 1; e >= 0; e--) {
2175
- let t = this.getInstanceRect(a[e].id);
2176
- if (t && r >= t.x && r <= t.x + t.w && i >= t.y && i <= t.y + t.h) return a[e].id;
2177
- }
2178
- return null;
2179
- }
2180
- dispose() {
2181
- this.host && this.host.__kolKineticEngine === this && delete this.host.__kolKineticEngine, this.svg && this.svg.parentNode === this.host && this.host.removeChild(this.svg);
2182
- }
2183
- _syncInstances() {
2184
- let e = this.params.instances || [], t = e.map((e) => e.id).join("|");
2185
- if (t === this._instSig) return;
2186
- this._instSig = t;
2187
- let n = new Set(e.map((e) => e.id));
2188
- for (let [e, t] of this._rt) n.has(e) || (t.group.remove(), this._rt.delete(e));
2189
- for (let t of e) {
2190
- let e = this._rt.get(t.id);
2191
- if (!e) {
2192
- let n = W("g"), r = W("path");
2193
- r.setAttribute("fill", "none");
2194
- let i = W("g");
2195
- i.setAttribute("data-glyphs", t.id), n.append(r, i), e = {
2196
- group: n,
2197
- pathEl: r,
2198
- glyphG: i,
2199
- glyphEls: [],
2200
- cache: null,
2201
- glyphKey: "",
2202
- closed: !1
2203
- }, this._rt.set(t.id, e);
2204
- }
2205
- this.layer.appendChild(e.group);
2206
- }
2207
- }
2208
- _render(e) {
2209
- let t = this.params.clip !== !1;
2210
- if (t !== this._clipApplied && (this._clipApplied = t, this.svg.style.overflow = t ? "hidden" : "visible"), this._needsRemeasure) {
2211
- this._needsRemeasure = !1;
2212
- for (let e of this._rt.values()) e.cache = null;
2213
- }
2214
- this.bg.setAttribute("fill", this.params.bg || "#16202E"), this._syncInstances();
2215
- for (let t of this.params.instances || []) {
2216
- let n = this._rt.get(t.id);
2217
- n && this._renderInstance(t, n, e);
2218
- }
2219
- }
2220
- _ensureGlyphs(e, t, n, r) {
2221
- let i = `${t}|${n.family}|${r}`;
2222
- if (i !== e.glyphKey) {
2223
- e.glyphKey = i, e.glyphG.textContent = "", e.glyphEls = [];
2224
- for (let n = 0; n < r; n++) for (let n of t) {
2225
- let t = W("text");
2226
- t.setAttribute("text-anchor", "middle"), t.setAttribute("dominant-baseline", "central"), t.textContent = n, e.glyphG.appendChild(t), e.glyphEls.push(t);
2227
- }
2228
- }
2229
- }
2230
- _measure(e, t, n, r) {
2231
- let i = t.letterSpacing || 0, a = We(t.opentype), o = `${r}|${n.family}|${t.fontSize}|${i}|${w(t.vf)}|${a}`;
2232
- if (e.cache && e.cache.key === o) return e.cache;
2233
- let s = this.measEl;
2234
- s.style.fontFamily = `'${n.family}'`, s.style.fontSize = `${t.fontSize}px`, s.style.letterSpacing = `${i}px`, s.style.fontVariationSettings = w(t.vf), s.style.fontFeatureSettings = a, s.textContent = r;
2235
- let c = r.length, l = Array(c), u = 0;
2236
- try {
2237
- u = s.getComputedTextLength();
2238
- let e = Array(c);
2239
- for (let t = 0; t < c; t++) e[t] = s.getStartPositionOfChar(t).x;
2240
- for (let t = 0; t < c; t++) l[t] = (e[t] + (t + 1 < c ? e[t + 1] : u)) / 2;
2241
- } catch {
2242
- u = t.fontSize * .6 * c;
2243
- for (let e = 0; e < c; e++) l[e] = (e + .5) * (u / Math.max(1, c));
2244
- }
2245
- return e.cache = {
2246
- key: o,
2247
- centers: l,
2248
- total: u
2249
- }, e.cache;
2250
- }
2251
- _renderInstance(e, t, n) {
2252
- let r = v(e.font), i = e.phase ? U(n + e.phase) : n, a = Ke(e.text || "", e.case), s = Math.max(1, Math.round(e.multiply || 1)), l = s > 1 && a ? Array(s).fill(a).join(" ") : a, u = e.path?.type || "line", d = (e.offset?.x || 0) * this.w, f = (e.offset?.y || 0) * this.h;
2253
- if (t.group.setAttribute("transform", `translate(${d.toFixed(2)} ${f.toFixed(2)})`), e.morph?.on && !Ce(u) && !we(u)) {
2254
- let n = r.url, a = e.morph.face2 ? v(e.morph.face2) : null, s = a ? a.url : n, d = c(n), f = c(s);
2255
- if (d && f) {
2256
- this._setKind(t, "morph"), this._renderMorph(e, t, i, d, f, r, l, u);
2257
- return;
2258
- }
2259
- d || o(n).catch(() => {}), !f && s !== n && o(s).catch(() => {});
2260
- }
2261
- if (this._setKind(t, "text"), L(u)) {
2262
- t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2263
- let n = Math.max(1, Math.round(e.path?.rows ?? 2)), a = Math.max(1, Math.round(e.path?.cols ?? 3));
2264
- if (this._ensureGlyphs(t, l, r, n * a), !l.length) return;
2265
- this._measure(t, e, r, l), this._placeArray(e, t, r, i, t.glyphEls, n, a);
2266
- return;
2267
- }
2268
- if (Ce(u) || we(u)) {
2269
- t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2270
- let n = Math.max(1, Math.round(e.path?.count ?? 12));
2271
- if (this._ensureGlyphs(t, l, r, n), !l.length) return;
2272
- this._measure(t, e, r, l), Ce(u) ? this._placeRadial(e, t, r, i, t.glyphEls, n) : this._placeRings(e, t, r, i, t.glyphEls, n);
2273
- return;
2274
- }
2275
- let p = Ee(u, this.w, this.h, e.path || {});
2276
- t.closed = p.closed, t.pathEl.setAttribute("d", p.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._ensureGlyphs(t, l, r, 1), l.length && (this._measure(t, e, r, l), this._placeOnPath(e, t, r, i, t.glyphEls));
2277
- }
2278
- _styleGlyph(e, t, n, r) {
2279
- e.style.fontFamily = `'${n.family}'`, e.style.fontSize = `${t.fontSize}px`, e.style.fontStyle = t.italic ? "italic" : "normal", e.style.fontVariationSettings = w(r.vf ? {
2280
- ...t.vf,
2281
- ...r.vf
2282
- } : t.vf), e.style.fontFeatureSettings = We(t.opentype), e.setAttribute("fill", t.fill || "#e8e4dc"), e.setAttribute("opacity", r.opacity);
2283
- }
2284
- _anim(e, t, n) {
2285
- let r = e.motions && e.motions.length ? [e.motion, ...e.motions] : [e.motion], i = 0, a = 0, o = 0, s = 1, c = 1, l = null;
2286
- for (let e of r) {
2287
- if (!e || (e.mode || "none") === "none") continue;
2288
- let r = n.axes.find((t) => t.tag === (e.axis || n.axes[0] && n.axes[0].tag)), u = He(e.mode, {
2289
- ...t,
2290
- m: e,
2291
- axisTag: r ? r.tag : "wght",
2292
- axisMin: r ? r.min : 100,
2293
- axisMax: r ? r.max : 900
2294
- });
2295
- i += u.dLen, a += u.dNormal, o += u.dRot, s *= u.scale, c *= u.opacity, u.vf && (l = {
2296
- ...l || {},
2297
- ...u.vf
2298
- });
2299
- }
2300
- return {
2301
- dLen: i,
2302
- dNormal: a,
2303
- scale: s,
2304
- dRot: o,
2305
- opacity: c,
2306
- vf: l
2307
- };
2308
- }
2309
- _placeOnPath(e, t, n, r, i) {
2310
- let a = t.cache;
2311
- if (!a) return;
2312
- let o = t.pathEl.getTotalLength();
2313
- if (!o) return;
2314
- let { centers: s, total: c } = a, l = e.align || "center", u = l === "start" ? 0 : l === "end" ? o - c : (o - c) / 2, d = .75, f = t.closed, p = e.flow === "flow" && !f, m = (e) => f ? (e % o + o) % o : Math.max(0, Math.min(o, e)), h = (e) => {
2315
- if (p && (e < 0 || e > o)) {
2316
- let n = e < 0 ? 0 : o, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - d)), a = t.pathEl.getPointAtLength(Math.min(o, n + d)), s = a.x - i.x, c = a.y - i.y, l = Math.hypot(s, c) || 1;
2317
- s /= l, c /= l;
2318
- let u = e - n;
2319
- return {
2320
- x: r.x + s * u,
2321
- y: r.y + c * u
2322
- };
2323
- }
2324
- return t.pathEl.getPointAtLength(m(e));
2325
- }, _ = Math.min(i.length, s.length), v = g(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (s.length + 2) / y;
2326
- for (let t = 0; t < _; t++) {
2327
- let a = u + s[t], c = h(a), l = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
2328
- i: t,
2329
- n: s.length,
2330
- u: l,
2331
- sizePx: e.fontSize,
2332
- pathLen: o,
2333
- nx: this.w ? c.x / this.w : .5,
2334
- ny: this.h ? c.y / this.h : .5
2335
- }, n), p = a + f.dLen, m = h(p), g = h(p - d), _ = h(p + d), x = Math.atan2(_.y - g.y, _.x - g.x) * 180 / Math.PI;
2336
- i[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(x + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})`), this._styleGlyph(i[t], e, n, f);
2337
- }
2338
- }
2339
- _placeArray(e, t, n, r, i, a, o) {
2340
- let s = t.cache;
2341
- if (!s) return;
2342
- let { centers: c, total: l } = s, u = c.length;
2343
- if (!u) return;
2344
- let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / o, p = (this.h - 2 * d) / a, m = g(e.stagger || 0), h = a * o;
2345
- for (let t = 0; t < h; t++) {
2346
- let a = Math.floor(t / o), s = d + t % o * f + f / 2, g = d + a * p + p / 2, _ = s - l / 2, v = m ? U(r + m * t / h) : r;
2347
- for (let r = 0; r < u; r++) {
2348
- let a = i[t * u + r];
2349
- if (!a) continue;
2350
- let o = _ + c[r], s = this._anim(e, {
2351
- i: t * u + r,
2352
- n: h * u,
2353
- u: v,
2354
- sizePx: e.fontSize,
2355
- pathLen: 0,
2356
- nx: this.w ? o / this.w : .5,
2357
- ny: this.h ? g / this.h : .5
2358
- }, n), l = g - s.dNormal;
2359
- a.setAttribute("transform", `translate(${o.toFixed(2)} ${l.toFixed(2)}) rotate(${s.dRot.toFixed(2)}) scale(${s.scale.toFixed(3)})`), this._styleGlyph(a, e, n, s);
2360
- }
2361
- }
2362
- }
2363
- _placeRadial(e, t, n, r, i, a) {
2364
- let o = t.cache;
2365
- if (!o) return;
2366
- let { centers: s } = o, c = s.length;
2367
- if (!c) return;
2368
- let l = this.w / 2, u = this.h / 2, d = Math.min(this.w, this.h) * .5, f = d * Math.max(0, Math.min(.95, e.path?.inner ?? .12)), p = Math.round(e.path?.spin ?? 1), m = g(e.stagger || 0);
2369
- for (let t = 0; t < a; t++) {
2370
- let o = a > 1 ? t / (a - 1) : 0, h = p + (m ? Math.round(m * 2 * o) : 0), g = t / a * b + r * b * h, _ = m ? U(r + m * t / a) : r, v = Math.cos(g), y = Math.sin(g), x = g * 180 / Math.PI;
2371
- for (let r = 0; r < c; r++) {
2372
- let o = t * c + r, p = i[o];
2373
- if (!p) continue;
2374
- let m = f + s[r], h = l + v * m, g = u + y * m, b = this._anim(e, {
2375
- i: o,
2376
- n: a * c,
2377
- u: _,
2378
- sizePx: e.fontSize,
2379
- pathLen: d,
2380
- nx: this.w ? h / this.w : .5,
2381
- ny: this.h ? g / this.h : .5
2382
- }, n), S = m + b.dLen, C = l + v * S, w = u + y * S;
2383
- p.setAttribute("transform", `translate(${C.toFixed(2)} ${w.toFixed(2)}) rotate(${(x + b.dRot).toFixed(2)}) translate(0 ${(-b.dNormal).toFixed(2)}) scale(${b.scale.toFixed(3)})`), this._styleGlyph(p, e, n, b);
2384
- }
2385
- }
2386
- }
2387
- _placeRings(e, t, n, r, i, a) {
2388
- let o = t.cache;
2389
- if (!o) return;
2390
- let { centers: s, total: c } = o, l = s.length;
2391
- if (!l) return;
2392
- let u = this.w / 2, d = this.h / 2, f = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, e.path?.radius ?? .92)), p = f * Math.max(.02, Math.min(.95, e.path?.inner ?? .14)), m = Math.round(e.path?.spin ?? 1), h = e.path?.twist ?? .5, _ = e.path?.grow ?? .6, v = g(e.stagger || 0);
2393
- for (let t = 0; t < a; t++) {
2394
- let o = a > 1 ? t / (a - 1) : 0, g = Math.max(1, p + o * (f - p)), y = m + (v ? Math.round(v * 2 * o) : 0), x = r * b * y + o * h * b, S = v ? U(r + v * t / a) : r, C = 1 + _ * o;
2395
- for (let r = 0; r < l; r++) {
2396
- let o = t * l + r, f = i[o];
2397
- if (!f) continue;
2398
- let p = x + (s[r] - c / 2) / g, m = u + Math.cos(p) * g, h = d + Math.sin(p) * g, _ = this._anim(e, {
2399
- i: o,
2400
- n: a * l,
2401
- u: S,
2402
- sizePx: e.fontSize,
2403
- pathLen: b * g,
2404
- nx: this.w ? m / this.w : .5,
2405
- ny: this.h ? h / this.h : .5
2406
- }, n), v = p + _.dLen / g, y = g - _.dNormal, w = u + Math.cos(v) * y, ee = d + Math.sin(v) * y, te = v * 180 / Math.PI + 90 + _.dRot;
2407
- f.setAttribute("transform", `translate(${w.toFixed(2)} ${ee.toFixed(2)}) rotate(${te.toFixed(2)}) scale(${(_.scale * C).toFixed(3)})`), this._styleGlyph(f, e, n, _);
2408
- }
2409
- }
2410
- }
2411
- _setKind(e, t) {
2412
- e.kind !== t && (e.kind = t, e.glyphG.textContent = "", e.glyphEls = [], e.morphEls = [], e.glyphKey = "", e.morphKey = "", e.morphPoolKey = "", e.cache = null);
2413
- }
2414
- _renderMorph(e, t, n, r, i, a, o, s) {
2415
- let c = e.fontSize, l = a.axes || [], u = {};
2416
- for (let t of l) u[t.tag] = e.vf?.[t.tag] ?? t.def;
2417
- let d = !!e.morph.face2, f = {};
2418
- if (!d) for (let t of l) f[t.tag] = e.morph.vf2?.[t.tag] ?? t.max;
2419
- let p = c * .12 + (e.letterSpacing || 0), h = e.morph.mode || "morph", g = e.morph.blend ?? .5, _ = e.morph.curve || "flat", v = e.morph.cp1 || {
2420
- x: .33,
2421
- y: .33
2422
- }, y = e.morph.cp2 || {
2423
- x: .66,
2424
- y: .66
2425
- }, b = e.fill || "#e8e4dc", x = JSON.stringify([
2426
- o,
2427
- e.font,
2428
- e.morph.face2 || "",
2429
- c,
2430
- u,
2431
- f,
2432
- h,
2433
- g,
2434
- _,
2435
- v,
2436
- y,
2437
- e.letterSpacing || 0,
2438
- b
2439
- ]), S = x !== t.morphKey;
2440
- if (S) {
2441
- t.morphKey = x;
2442
- let e = m(r, i, o, c, {
2443
- mode: h,
2444
- blend: g,
2445
- curve: _,
2446
- cp1: v,
2447
- cp2: y,
2448
- coordsA: u,
2449
- coordsB: f,
2450
- axes: l,
2451
- gap: p
2452
- });
2453
- t.morphData = e;
2454
- let n = [], a = 0;
2455
- for (let t of e.glyphs) n.push(a + t.advance / 2), a += t.advance;
2456
- t.morphCenters = n, t.morphTotal = e.totalAdvance;
2457
- }
2458
- let C = t.morphData?.glyphs.length || 0;
2459
- if (!o.length || !C) {
2460
- t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2461
- return;
2462
- }
2463
- let w = L(s), ee = w ? Math.max(1, Math.round(e.path?.rows ?? 2)) : 1, te = w ? Math.max(1, Math.round(e.path?.cols ?? 3)) : 1, ne = w ? ee * te : 1, T = this._ensureMorphPool(t, C, ne, h);
2464
- if ((S || T) && this._refreshMorphPaths(t, ne, h, b), w) {
2465
- t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0, this._placeMorphArray(e, t, a, n, ee, te);
2466
- return;
2467
- }
2468
- let E = Ee(s, this.w, this.h, e.path || {});
2469
- t.closed = E.closed, t.pathEl.setAttribute("d", E.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._placeMorphOnPath(e, t, a, n);
2470
- }
2471
- _ensureMorphPool(e, t, n, r) {
2472
- let i = `${t}|${n}|${r}`;
2473
- if (i === e.morphPoolKey) return !1;
2474
- e.morphPoolKey = i, e.glyphG.textContent = "", e.morphEls = [];
2475
- let a = t * n;
2476
- for (let t = 0; t < a; t++) {
2477
- let t = W("g");
2478
- t.appendChild(W("path")), r === "fade" && t.appendChild(W("path")), e.glyphG.appendChild(t), e.morphEls.push(t);
2479
- }
2480
- return !0;
2481
- }
2482
- _refreshMorphPaths(e, t, n, r) {
2483
- let i = e.morphData?.glyphs || [], a = i.length;
2484
- if (a) for (let t = 0; t < e.morphEls.length; t++) {
2485
- let o = e.morphEls[t], s = i[t % a];
2486
- if (!s) continue;
2487
- let c = o.childNodes;
2488
- n === "fade" ? (this._setMorphPath(c[0], s.dA, s.bboxA, r, s.opA), this._setMorphPath(c[1], s.dB, s.bboxB, r, s.opB)) : this._setMorphPath(c[0], s.d, s.bbox, r, 1);
2489
- }
2490
- }
2491
- _setMorphPath(e, t, n, r, i) {
2492
- if (!e) return;
2493
- e.setAttribute("d", t || ""), e.setAttribute("fill", r), e.setAttribute("fill-rule", "evenodd"), e.setAttribute("opacity", i);
2494
- let a = (n.x1 + n.x2) / 2, o = (n.y1 + n.y2) / 2;
2495
- e.setAttribute("transform", `translate(${(-a).toFixed(2)} ${(-o).toFixed(2)})`);
2496
- }
2497
- _placeMorphOnPath(e, t, n, r, i = t.morphEls) {
2498
- let a = t.morphCenters, o = t.morphTotal;
2499
- if (!a || !i) return;
2500
- let s = t.pathEl.getTotalLength();
2501
- if (!s) return;
2502
- let c = e.align || "center", l = c === "start" ? 0 : c === "end" ? s - o : (s - o) / 2, u = .75, d = t.closed, f = e.flow === "flow" && !d, p = (e) => d ? (e % s + s) % s : Math.max(0, Math.min(s, e)), m = (e) => {
2503
- if (f && (e < 0 || e > s)) {
2504
- let n = e < 0 ? 0 : s, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - u)), a = t.pathEl.getPointAtLength(Math.min(s, n + u)), o = a.x - i.x, c = a.y - i.y, l = Math.hypot(o, c) || 1;
2505
- o /= l, c /= l;
2506
- let d = e - n;
2507
- return {
2508
- x: r.x + o * d,
2509
- y: r.y + c * d
2510
- };
2511
- }
2512
- return t.pathEl.getPointAtLength(p(e));
2513
- }, h = e.italic ? " skewX(-12)" : "", _ = Math.min(i.length, a.length), v = g(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (a.length + 2) / y;
2514
- for (let t = 0; t < _; t++) {
2515
- let o = l + a[t], c = m(o), d = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
2516
- i: t,
2517
- n: a.length,
2518
- u: d,
2519
- sizePx: e.fontSize,
2520
- pathLen: s,
2521
- nx: this.w ? c.x / this.w : .5,
2522
- ny: this.h ? c.y / this.h : .5
2523
- }, n), p = o + f.dLen, g = m(p), _ = m(p - u), x = m(p + u), S = Math.atan2(x.y - _.y, x.x - _.x) * 180 / Math.PI;
2524
- i[t].setAttribute("transform", `translate(${g.x.toFixed(2)} ${g.y.toFixed(2)}) rotate(${(S + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})${h}`), i[t].setAttribute("opacity", f.opacity);
2525
- }
2526
- }
2527
- _placeMorphArray(e, t, n, r, i, a, o = t.morphEls) {
2528
- let s = t.morphCenters, c = t.morphTotal;
2529
- if (!s || !o) return;
2530
- let l = s.length;
2531
- if (!l) return;
2532
- let u = Math.min(this.w, this.h) * .08, d = (this.w - 2 * u) / a, f = (this.h - 2 * u) / i, p = e.italic ? " skewX(-12)" : "", m = g(e.stagger || 0), h = i * a;
2533
- for (let t = 0; t < h; t++) {
2534
- let i = Math.floor(t / a), g = u + t % a * d + d / 2, _ = u + i * f + f / 2, v = g - c / 2, y = m ? U(r + m * t / h) : r;
2535
- for (let r = 0; r < l; r++) {
2536
- let i = t * l + r, a = o[i];
2537
- if (!a) continue;
2538
- let c = v + s[r], u = this._anim(e, {
2539
- i,
2540
- n: h * l,
2541
- u: y,
2542
- sizePx: e.fontSize,
2543
- pathLen: 0,
2544
- nx: this.w ? c / this.w : .5,
2545
- ny: this.h ? _ / this.h : .5
2546
- }, n), d = _ - u.dNormal;
2547
- a.setAttribute("transform", `translate(${c.toFixed(2)} ${d.toFixed(2)}) rotate(${u.dRot.toFixed(2)}) scale(${u.scale.toFixed(3)})${p}`), a.setAttribute("opacity", u.opacity);
2548
- }
2549
- }
2550
- }
2551
- }, G = (e, t = 0) => e?.instances?.[t] ?? null, K = (e, t, n = 0) => ({
2552
- ...e,
2553
- instances: (e.instances ?? []).map((e, r) => r === n ? {
2554
- ...e,
2555
- ...t
2556
- } : e)
2557
- }), Ye = (e, t) => ({
2558
- ...e,
2559
- instances: (e.instances ?? []).map((e, n, r) => ({
2560
- ...e,
2561
- ...t(e, n, r.length)
2562
- }))
2563
- }), q = (e, t, n = 0) => K(e, { path: {
2564
- ...G(e, n)?.path ?? {},
2565
- ...t
2566
- } }, n), J = (e, t, n = 0) => K(e, { motion: {
2567
- ...G(e, n)?.motion ?? {},
2568
- ...t
2569
- } }, n), Y = (e, t = 0) => G(e, t)?.path?.type ?? "line", Xe = (e, t = 0) => G(e, t)?.motion?.mode ?? "none", Ze = (e, t = 0) => ![
2570
- "radial",
2571
- "rings",
2572
- "array"
2573
- ].includes(Y(e, t)), Qe = [
2574
- {
2575
- value: "line",
2576
- label: "Line"
2577
- },
2578
- {
2579
- value: "arc",
2580
- label: "Arc"
2581
- },
2582
- {
2583
- value: "sine",
2584
- label: "Sine"
2585
- },
2586
- {
2587
- value: "zigzag",
2588
- label: "Zigzag"
2589
- },
2590
- {
2591
- value: "spiral",
2592
- label: "Spiral"
2593
- },
2594
- {
2595
- value: "circle",
2596
- label: "Circle"
2597
- },
2598
- {
2599
- value: "ellipse",
2600
- label: "Ellipse"
2601
- },
2602
- {
2603
- value: "custom",
2604
- label: "Custom"
2605
- },
2606
- {
2607
- value: "array",
2608
- label: "Array"
2609
- },
2610
- {
2611
- value: "radial",
2612
- label: "Radial"
2613
- },
2614
- {
2615
- value: "rings",
2616
- label: "Rings"
2617
- }
2618
- ], X = (e, t = 0) => G(e, t)?.morph ?? {}, Z = (e, t, n = 0) => K(e, { morph: {
2619
- ...G(e, n)?.morph ?? {},
2620
- ...t
2621
- } }, n), $e = (e, t, n, r = 0) => Z(e, { vf2: {
2622
- ...X(e, r).vf2 ?? {},
2623
- [t]: n
2624
- } }, r), et = (e, t = 0) => !["radial", "rings"].includes(Y(e, t)), Q = (e, t = 0) => et(e, t) && !!X(e, t).on, tt = (e, t = 0) => X(e, t).mode ?? "morph", nt = (e, t = 0) => Q(e, t) && ["morph", "fade"].includes(tt(e, t)), $ = (e, t, n = 0) => v(G(e, n)?.font).axes.find((e) => e.tag === t), rt = (e, t, n, r = 0) => {
2625
- let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
2626
- return $e(e, t, Math.round(a), r);
2627
- }, it = (e, t, n, r = 0) => {
2628
- let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
2629
- return K(e, { vf: {
2630
- ...G(e, r)?.vf ?? {},
2631
- [t]: Math.round(a)
2632
- } }, r);
2633
- }, at = (e) => ({
2634
- key: `vf${e[0].toUpperCase()}${e.slice(1)}`,
2635
- label: ne[e] || e,
2636
- tab: "style",
2637
- section: "Axes",
2638
- type: "range",
2639
- step: 1,
2640
- min: (t, n = 0) => $(t, e, n)?.min ?? 0,
2641
- max: (t, n = 0) => $(t, e, n)?.max ?? 1e3,
2642
- when: (t, n = 0) => !!$(t, e, n),
2643
- get: (t, n = 0) => G(t, n)?.vf?.[e] ?? $(t, e, n)?.def ?? 0,
2644
- set: (t, n, r = 0) => it(t, e, n, r)
2645
- }), ot = (e, t = 0) => Q(e, t) && tt(e, t) === "morph" && (X(e, t).curve ?? "flat") === "custom", st = (e, t) => ({
2646
- key: `morphC${e}${t}`,
2647
- label: `P${e} ${t.toUpperCase()}`,
2648
- tab: "style",
2649
- section: "Morph",
2650
- type: "range",
2651
- min: 0,
2652
- max: 1,
2653
- step: .01,
2654
- noRandom: !0,
2655
- when: ot,
2656
- get: (n, r = 0) => X(n, r)[`cp${e}`]?.[t] ?? (e === 1 ? .33 : .66),
2657
- set: (n, r, i = 0) => Z(n, { [`cp${e}`]: {
2658
- ...X(n, i)[`cp${e}`] ?? {
2659
- x: e === 1 ? .33 : .66,
2660
- y: e === 1 ? .33 : .66
2661
- },
2662
- [t]: r
2663
- } }, i)
2664
- }), ct = [
2665
- {
2666
- key: "bg",
2667
- label: "Background",
2668
- tab: "style",
2669
- type: "color",
2670
- noRandom: !0,
2671
- get: (e) => e.bg,
2672
- set: (e, t) => ({
2673
- ...e,
2674
- bg: t
2675
- })
2676
- },
2677
- {
2678
- key: "fill",
2679
- label: "Fill",
2680
- tab: "style",
2681
- type: "color",
2682
- noRandom: !0,
2683
- get: (e, t = 0) => G(e, t)?.fill,
2684
- set: (e, t, n = 0) => K(e, { fill: t }, n)
2685
- },
2686
- {
2687
- key: "font",
2688
- label: "Font",
2689
- tab: "style",
2690
- type: "select",
2691
- options: C,
2692
- noRandom: !0,
2693
- get: (e, t = 0) => G(e, t)?.font,
2694
- set: (e, t, n = 0) => K(e, {
2695
- font: t,
2696
- vf: ke(t, G(e, n)?.vf)
2697
- }, n)
2698
- },
2699
- {
2700
- key: "italic",
2701
- label: "Italic",
2702
- tab: "style",
2703
- type: "select",
2704
- noRandom: !0,
2705
- options: [{
2706
- value: "off",
2707
- label: "Off"
2708
- }, {
2709
- value: "on",
2710
- label: "On"
2711
- }],
2712
- get: (e, t = 0) => G(e, t)?.italic ? "on" : "off",
2713
- set: (e, t, n = 0) => K(e, { italic: t === "on" }, n)
2714
- },
2715
- {
2716
- key: "case",
2717
- label: "Case",
2718
- tab: "style",
2719
- type: "select",
2720
- noRandom: !0,
2721
- options: [
2722
- {
2723
- value: "none",
2724
- label: "Aa"
2725
- },
2726
- {
2727
- value: "upper",
2728
- label: "AA"
2729
- },
2730
- {
2731
- value: "lower",
2732
- label: "aa"
2733
- },
2734
- {
2735
- value: "title",
2736
- label: "Tt"
2737
- }
2738
- ],
2739
- get: (e, t = 0) => G(e, t)?.case ?? "none",
2740
- set: (e, t, n = 0) => K(e, { case: t }, n)
2741
- },
2742
- {
2743
- key: "fontSize",
2744
- label: "Font size",
2745
- tab: "style",
2746
- type: "range",
2747
- min: 8,
2748
- max: 1200,
2749
- step: 1,
2750
- rMin: 36,
2751
- rMax: 150,
2752
- get: (e, t = 0) => G(e, t)?.fontSize ?? 26,
2753
- set: (e, t, n = 0) => K(e, { fontSize: Math.round(t) }, n)
2754
- },
2755
- {
2756
- key: "letterSpacing",
2757
- label: "Letter spacing",
2758
- tab: "style",
2759
- type: "range",
2760
- min: -10,
2761
- max: 400,
2762
- step: .5,
2763
- rMin: 0,
2764
- rMax: 12,
2765
- get: (e, t = 0) => G(e, t)?.letterSpacing ?? 0,
2766
- set: (e, t, n = 0) => K(e, { letterSpacing: t }, n)
2767
- },
2768
- {
2769
- key: "align",
2770
- label: "Align",
2771
- tab: "style",
2772
- type: "select",
2773
- noRandom: !0,
2774
- when: Ze,
2775
- options: [
2776
- {
2777
- value: "start",
2778
- label: "Start"
2779
- },
2780
- {
2781
- value: "center",
2782
- label: "Center"
2783
- },
2784
- {
2785
- value: "end",
2786
- label: "End"
2787
- }
2788
- ],
2789
- get: (e, t = 0) => G(e, t)?.align ?? "center",
2790
- set: (e, t, n = 0) => K(e, { align: t }, n)
2791
- },
2792
- {
2793
- key: "multiply",
2794
- label: "Copies",
2795
- tab: "style",
2796
- type: "range",
2797
- min: 1,
2798
- max: 24,
2799
- step: 1,
2800
- noRandom: !0,
2801
- when: Ze,
2802
- get: (e, t = 0) => G(e, t)?.multiply ?? 1,
2803
- set: (e, t, n = 0) => K(e, { multiply: Math.round(t) }, n)
2804
- },
2805
- at("wdth"),
2806
- at("wght"),
2807
- {
2808
- key: "arrangement",
2809
- label: "Arrangement",
2810
- tab: "style",
2811
- section: "Arrangement",
2812
- type: "select",
2813
- noRandom: !0,
2814
- options: Qe,
2815
- get: Y,
2816
- set: (e, t, n = 0) => q(e, { type: t }, n)
2817
- },
2818
- {
2819
- key: "spokes",
2820
- label: "Spokes",
2821
- tab: "style",
2822
- section: "Arrangement",
2823
- type: "range",
2824
- min: 2,
2825
- max: 32,
2826
- step: 1,
2827
- rMin: 6,
2828
- rMax: 28,
2829
- when: (e, t = 0) => Y(e, t) === "radial",
2830
- get: (e, t = 0) => G(e, t)?.path?.count ?? 12,
2831
- set: (e, t, n = 0) => q(e, { count: Math.round(t) }, n)
2832
- },
2833
- {
2834
- key: "rings",
2835
- label: "Rings",
2836
- tab: "style",
2837
- section: "Arrangement",
2838
- type: "range",
2839
- min: 2,
2840
- max: 24,
2841
- step: 1,
2842
- rMin: 4,
2843
- rMax: 16,
2844
- when: (e, t = 0) => Y(e, t) === "rings",
2845
- get: (e, t = 0) => G(e, t)?.path?.count ?? 12,
2846
- set: (e, t, n = 0) => q(e, { count: Math.round(t) }, n)
2847
- },
2848
- {
2849
- key: "inner",
2850
- label: "Inner radius",
2851
- tab: "style",
2852
- section: "Arrangement",
2853
- type: "range",
2854
- min: 0,
2855
- max: .9,
2856
- step: .01,
2857
- rMin: .04,
2858
- rMax: .4,
2859
- when: (e, t = 0) => Y(e, t) === "radial" || Y(e, t) === "rings",
2860
- get: (e, t = 0) => G(e, t)?.path?.inner ?? .12,
2861
- set: (e, t, n = 0) => q(e, { inner: t }, n)
2862
- },
2863
- {
2864
- key: "ringRadius",
2865
- label: "Radius",
2866
- tab: "style",
2867
- section: "Arrangement",
2868
- type: "range",
2869
- min: .1,
2870
- max: 1,
2871
- step: .01,
2872
- rMin: .6,
2873
- rMax: 1,
2874
- when: (e, t = 0) => Y(e, t) === "rings",
2875
- get: (e, t = 0) => G(e, t)?.path?.radius ?? .92,
2876
- set: (e, t, n = 0) => q(e, { radius: t }, n)
2877
- },
2878
- {
2879
- key: "twist",
2880
- label: "Twist",
2881
- tab: "style",
2882
- section: "Arrangement",
2883
- type: "range",
2884
- min: 0,
2885
- max: 2,
2886
- step: .05,
2887
- rMin: 0,
2888
- rMax: 1.5,
2889
- when: (e, t = 0) => Y(e, t) === "rings",
2890
- get: (e, t = 0) => G(e, t)?.path?.twist ?? .5,
2891
- set: (e, t, n = 0) => q(e, { twist: t }, n)
2892
- },
2893
- {
2894
- key: "grow",
2895
- label: "Grow",
2896
- tab: "style",
2897
- section: "Arrangement",
2898
- type: "range",
2899
- min: 0,
2900
- max: 2,
2901
- step: .05,
2902
- rMin: 0,
2903
- rMax: 1.5,
2904
- when: (e, t = 0) => Y(e, t) === "rings",
2905
- get: (e, t = 0) => G(e, t)?.path?.grow ?? .6,
2906
- set: (e, t, n = 0) => q(e, { grow: t }, n)
2907
- },
2908
- {
2909
- key: "pathRadius",
2910
- label: "Radius",
2911
- tab: "style",
2912
- section: "Arrangement",
2913
- type: "range",
2914
- min: .2,
2915
- max: 1,
2916
- step: .01,
2917
- rMin: .5,
2918
- rMax: 1,
2919
- when: (e, t = 0) => [
2920
- "circle",
2921
- "ellipse",
2922
- "spiral"
2923
- ].includes(Y(e, t)),
2924
- get: (e, t = 0) => G(e, t)?.path?.radius ?? .72,
2925
- set: (e, t, n = 0) => q(e, { radius: t }, n)
2926
- },
2927
- {
2928
- key: "turns",
2929
- label: "Turns",
2930
- tab: "style",
2931
- section: "Arrangement",
2932
- type: "range",
2933
- min: 1,
2934
- max: 6,
2935
- step: 1,
2936
- rMin: 2,
2937
- rMax: 5,
2938
- when: (e, t = 0) => Y(e, t) === "spiral",
2939
- get: (e, t = 0) => G(e, t)?.path?.turns ?? 3,
2940
- set: (e, t, n = 0) => q(e, { turns: Math.round(t) }, n)
2941
- },
2942
- {
2943
- key: "amp",
2944
- label: "Amplitude",
2945
- tab: "style",
2946
- section: "Arrangement",
2947
- type: "range",
2948
- min: 0,
2949
- max: 1,
2950
- step: .05,
2951
- rMin: .2,
2952
- rMax: .7,
2953
- when: (e, t = 0) => [
2954
- "arc",
2955
- "sine",
2956
- "zigzag"
2957
- ].includes(Y(e, t)),
2958
- get: (e, t = 0) => G(e, t)?.path?.amp ?? .4,
2959
- set: (e, t, n = 0) => q(e, { amp: t }, n)
2960
- },
2961
- {
2962
- key: "freq",
2963
- label: "Frequency",
2964
- tab: "style",
2965
- section: "Arrangement",
2966
- type: "range",
2967
- min: 1,
2968
- max: 6,
2969
- step: 1,
2970
- rMin: 1,
2971
- rMax: 4,
2972
- when: (e, t = 0) => ["sine", "zigzag"].includes(Y(e, t)),
2973
- get: (e, t = 0) => G(e, t)?.path?.freq ?? 2,
2974
- set: (e, t, n = 0) => q(e, { freq: Math.round(t) }, n)
2975
- },
2976
- {
2977
- key: "rows",
2978
- label: "Rows",
2979
- tab: "style",
2980
- section: "Arrangement",
2981
- type: "range",
2982
- min: 1,
2983
- max: 6,
2984
- step: 1,
2985
- rMin: 2,
2986
- rMax: 4,
2987
- when: (e, t = 0) => Y(e, t) === "array",
2988
- get: (e, t = 0) => G(e, t)?.path?.rows ?? 2,
2989
- set: (e, t, n = 0) => q(e, { rows: Math.round(t) }, n)
2990
- },
2991
- {
2992
- key: "cols",
2993
- label: "Columns",
2994
- tab: "style",
2995
- section: "Arrangement",
2996
- type: "range",
2997
- min: 1,
2998
- max: 8,
2999
- step: 1,
3000
- rMin: 2,
3001
- rMax: 6,
3002
- when: (e, t = 0) => Y(e, t) === "array",
3003
- get: (e, t = 0) => G(e, t)?.path?.cols ?? 3,
3004
- set: (e, t, n = 0) => q(e, { cols: Math.round(t) }, n)
3005
- },
3006
- {
3007
- key: "flow",
3008
- label: "Paragraph",
3009
- tab: "style",
3010
- section: "Arrangement",
3011
- type: "select",
3012
- noRandom: !0,
3013
- when: Ze,
3014
- options: [{
3015
- value: "flow",
3016
- label: "Flow"
3017
- }, {
3018
- value: "contain",
3019
- label: "Contain"
3020
- }],
3021
- get: (e, t = 0) => G(e, t)?.flow ?? "flow",
3022
- set: (e, t, n = 0) => K(e, { flow: t }, n)
3023
- },
3024
- {
3025
- key: "showPath",
3026
- label: "Show path",
3027
- tab: "style",
3028
- section: "Arrangement",
3029
- type: "select",
3030
- noRandom: !0,
3031
- when: Ze,
3032
- options: [{
3033
- value: "off",
3034
- label: "Off"
3035
- }, {
3036
- value: "on",
3037
- label: "On"
3038
- }],
3039
- get: (e, t = 0) => G(e, t)?.showPath ? "on" : "off",
3040
- set: (e, t, n = 0) => K(e, { showPath: t === "on" }, n)
3041
- },
3042
- {
3043
- key: "offsetX",
3044
- label: "X",
3045
- tab: "style",
3046
- section: "Position",
3047
- type: "range",
3048
- min: -1,
3049
- max: 1,
3050
- step: .01,
3051
- noRandom: !0,
3052
- get: (e, t = 0) => G(e, t)?.offset?.x ?? 0,
3053
- set: (e, t, n = 0) => K(e, { offset: {
3054
- ...G(e, n)?.offset ?? {},
3055
- x: t
3056
- } }, n)
3057
- },
3058
- {
3059
- key: "offsetY",
3060
- label: "Y",
3061
- tab: "style",
3062
- section: "Position",
3063
- type: "range",
3064
- min: -1,
3065
- max: 1,
3066
- step: .01,
3067
- noRandom: !0,
3068
- get: (e, t = 0) => G(e, t)?.offset?.y ?? 0,
3069
- set: (e, t, n = 0) => K(e, { offset: {
3070
- ...G(e, n)?.offset ?? {},
3071
- y: t
3072
- } }, n)
3073
- },
3074
- {
3075
- key: "morphOn",
3076
- label: "Morph outlines",
3077
- tab: "style",
3078
- section: "Morph",
3079
- type: "select",
3080
- noRandom: !0,
3081
- when: et,
3082
- options: [{
3083
- value: "off",
3084
- label: "Off"
3085
- }, {
3086
- value: "on",
3087
- label: "On"
3088
- }],
3089
- get: (e, t = 0) => X(e, t).on ? "on" : "off",
3090
- set: (e, t, n = 0) => Z(e, { on: t === "on" }, n)
3091
- },
3092
- {
3093
- key: "morphMode",
3094
- label: "Mode",
3095
- tab: "style",
3096
- section: "Morph",
3097
- type: "select",
3098
- when: Q,
3099
- options: d,
3100
- get: tt,
3101
- set: (e, t, n = 0) => Z(e, { mode: t }, n)
3102
- },
3103
- {
3104
- key: "morphFace2",
3105
- label: "Cut B face",
3106
- tab: "style",
3107
- section: "Morph",
3108
- type: "select",
3109
- noRandom: !0,
3110
- when: nt,
3111
- options: (e, t = 0) => [{
3112
- value: "",
3113
- label: "Off"
3114
- }, ...C.filter((n) => n.value !== G(e, t)?.font)],
3115
- get: (e, t = 0) => X(e, t).face2 ?? "",
3116
- set: (e, t, n = 0) => Z(e, { face2: t }, n)
3117
- },
3118
- {
3119
- key: "morphVf2Wdth",
3120
- label: "Cut B · Width",
3121
- tab: "style",
3122
- section: "Morph",
3123
- type: "range",
3124
- min: 64,
3125
- max: 172,
3126
- step: 1,
3127
- when: (e, t = 0) => nt(e, t) && !X(e, t).face2 && !!$(e, "wdth", t),
3128
- get: (e, t = 0) => X(e, t).vf2?.wdth ?? $(e, "wdth", t)?.max ?? 172,
3129
- set: (e, t, n = 0) => rt(e, "wdth", t, n)
3130
- },
3131
- {
3132
- key: "morphVf2Wght",
3133
- label: "Cut B · Weight",
3134
- tab: "style",
3135
- section: "Morph",
3136
- type: "range",
3137
- min: 100,
3138
- max: 900,
3139
- step: 1,
3140
- when: (e, t = 0) => nt(e, t) && !X(e, t).face2 && !!$(e, "wght", t),
3141
- get: (e, t = 0) => X(e, t).vf2?.wght ?? $(e, "wght", t)?.max ?? 900,
3142
- set: (e, t, n = 0) => rt(e, "wght", t, n)
3143
- },
3144
- {
3145
- key: "morphCurve",
3146
- label: "Curve",
3147
- tab: "style",
3148
- section: "Morph",
3149
- type: "select",
3150
- when: (e, t = 0) => Q(e, t) && tt(e, t) === "morph",
3151
- options: a,
3152
- get: (e, t = 0) => X(e, t).curve ?? "flat",
3153
- set: (e, t, n = 0) => Z(e, { curve: t }, n)
3154
- },
3155
- st(1, "x"),
3156
- st(1, "y"),
3157
- st(2, "x"),
3158
- st(2, "y"),
3159
- {
3160
- key: "morphBlend",
3161
- label: "Blend",
3162
- tab: "style",
3163
- section: "Morph",
3164
- type: "range",
3165
- min: 0,
3166
- max: 1,
3167
- step: .01,
3168
- when: (e, t = 0) => Q(e, t) && tt(e, t) !== "random",
3169
- get: (e, t = 0) => X(e, t).blend ?? .5,
3170
- set: (e, t, n = 0) => Z(e, { blend: t }, n)
3171
- },
3172
- {
3173
- key: "morphSeed",
3174
- label: "Seed",
3175
- tab: "style",
3176
- section: "Morph",
3177
- type: "range",
3178
- min: 0,
3179
- max: 1,
3180
- step: .01,
3181
- when: (e, t = 0) => Q(e, t) && tt(e, t) === "random",
3182
- get: (e, t = 0) => X(e, t).blend ?? .5,
3183
- set: (e, t, n = 0) => Z(e, { blend: t }, n)
3184
- },
3185
- {
3186
- key: "mode",
3187
- label: "Motion",
3188
- tab: "anim",
3189
- type: "select",
3190
- noRandom: !0,
3191
- options: [
3192
- {
3193
- value: "none",
3194
- label: "None"
3195
- },
3196
- {
3197
- value: "march",
3198
- label: "March"
3199
- },
3200
- {
3201
- value: "orbit",
3202
- label: "Orbit"
3203
- },
3204
- {
3205
- value: "vfwave",
3206
- label: "Axis wave"
3207
- },
3208
- {
3209
- value: "glyphwave",
3210
- label: "Glyph wave"
3211
- },
3212
- {
3213
- value: "cascade",
3214
- label: "Cascade"
3215
- },
3216
- {
3217
- value: "sweep",
3218
- label: "Sweep"
3219
- },
3220
- {
3221
- value: "sweepWeight",
3222
- label: "Sweep weight"
3223
- },
3224
- {
3225
- value: "sweepShift",
3226
- label: "Sweep shift"
3227
- }
3228
- ],
3229
- get: Xe,
3230
- set: (e, t, n = 0) => J(e, { mode: t }, n)
3231
- },
3232
- {
3233
- key: "cycles",
3234
- label: "Cycles",
3235
- tab: "anim",
3236
- type: "range",
3237
- min: 1,
3238
- max: 4,
3239
- step: 1,
3240
- rMin: 1,
3241
- rMax: 3,
3242
- when: (e, t = 0) => Xe(e, t) !== "none",
3243
- get: (e, t = 0) => G(e, t)?.motion?.cycles ?? 1,
3244
- set: (e, t, n = 0) => J(e, { cycles: Math.round(t) }, n)
3245
- },
3246
- {
3247
- key: "motionAmp",
3248
- label: "Amount",
3249
- tab: "anim",
3250
- type: "range",
3251
- min: .05,
3252
- max: 1,
3253
- step: .05,
3254
- rMin: .15,
3255
- rMax: .6,
3256
- when: (e, t = 0) => [
3257
- "glyphwave",
3258
- "sweep",
3259
- "sweepWeight",
3260
- "sweepShift"
3261
- ].includes(Xe(e, t)),
3262
- get: (e, t = 0) => G(e, t)?.motion?.amp ?? .3,
3263
- set: (e, t, n = 0) => J(e, { amp: t }, n)
3264
- },
3265
- {
3266
- key: "motionPhase",
3267
- label: "Glyph phase",
3268
- tab: "anim",
3269
- type: "range",
3270
- min: 0,
3271
- max: 1.5,
3272
- step: .05,
3273
- rMin: .3,
3274
- rMax: 1,
3275
- when: (e, t = 0) => [
3276
- "vfwave",
3277
- "glyphwave",
3278
- "cascade"
3279
- ].includes(Xe(e, t)),
3280
- get: (e, t = 0) => G(e, t)?.motion?.phase ?? .5,
3281
- set: (e, t, n = 0) => J(e, { phase: t }, n)
3282
- },
3283
- {
3284
- key: "axis",
3285
- label: "Axis",
3286
- tab: "anim",
3287
- type: "select",
3288
- when: (e, t = 0) => ["vfwave", "sweepWeight"].includes(Xe(e, t)) && v(G(e, t)?.font).axes.length > 1,
3289
- options: (e, t = 0) => v(G(e, t)?.font).axes.map((e) => ({
3290
- value: e.tag,
3291
- label: ne[e.tag] || e.tag
3292
- })),
3293
- get: (e, t = 0) => G(e, t)?.motion?.axis ?? "wght",
3294
- set: (e, t, n = 0) => J(e, { axis: t }, n)
3295
- },
3296
- {
3297
- key: "field",
3298
- label: "Field",
3299
- tab: "anim",
3300
- type: "select",
3301
- when: (e, t = 0) => [
3302
- "sweep",
3303
- "sweepWeight",
3304
- "sweepShift"
3305
- ].includes(Xe(e, t)),
3306
- options: [
3307
- {
3308
- value: "x",
3309
- label: "Horizontal"
3310
- },
3311
- {
3312
- value: "y",
3313
- label: "Vertical"
3314
- },
3315
- {
3316
- value: "diagonal",
3317
- label: "Diagonal"
3318
- },
3319
- {
3320
- value: "radial",
3321
- label: "Radial"
3322
- },
3323
- {
3324
- value: "angular",
3325
- label: "Angular"
3326
- },
3327
- {
3328
- value: "wave",
3329
- label: "Wave"
3330
- }
3331
- ],
3332
- get: (e, t = 0) => G(e, t)?.motion?.field ?? "x",
3333
- set: (e, t, n = 0) => J(e, { field: t }, n)
3334
- },
3335
- {
3336
- key: "stagger",
3337
- label: "Stagger",
3338
- tab: "anim",
3339
- type: "range",
3340
- min: 0,
3341
- max: 1,
3342
- step: .01,
3343
- get: (e) => G(e)?.stagger ?? 0,
3344
- set: (e, t) => Ye(e, (e, n, r) => ({
3345
- stagger: t,
3346
- phase: r > 1 ? n / r * t : 0
3347
- }))
3348
- },
3349
- {
3350
- key: "spin",
3351
- label: "Spin",
3352
- tab: "anim",
3353
- type: "range",
3354
- min: 0,
3355
- max: 4,
3356
- step: 1,
3357
- rMin: 0,
3358
- rMax: 3,
3359
- when: (e, t = 0) => Y(e, t) === "radial" || Y(e, t) === "rings",
3360
- get: (e, t = 0) => G(e, t)?.path?.spin ?? 1,
3361
- set: (e, t, n = 0) => q(e, { spin: Math.round(t) }, n)
3362
- }
3363
- ], lt = (e, t, n = 0) => typeof e.options == "function" ? e.options(t, n) : e.options ?? [], ut = (e, t, n = 0) => ({
3364
- min: typeof e.min == "function" ? e.min(t, n) : e.min,
3365
- max: typeof e.max == "function" ? e.max(t, n) : e.max
3366
- });
3367
- function dt(e, t = 0, n = Math.random) {
3368
- let r = e;
3369
- for (let e of ct) if (!(e.noRandom || e.type === "color") && !(e.when && !e.when(r, t))) {
3370
- if (e.type === "range") {
3371
- let i = ut(e, r, t), a = e.rMin ?? i.min, o = e.rMax ?? i.max, s = e.step ?? 1, c = a + n() * (o - a);
3372
- r = e.set(r, Math.min(o, Math.max(a, Number((Math.round(c / s) * s).toFixed(4)))), t);
3373
- } else if (e.type === "select") {
3374
- let i = lt(e, r, t);
3375
- i.length && (r = e.set(r, i[Math.floor(n() * i.length)].value, t));
3376
- }
3377
- }
3378
- return r;
3379
- }
3380
- //#endregion
3381
- //#region src/editor/compose/inspectors/KineticPanel.jsx
3382
- var ft = {
3383
- key: "morphBlend",
3384
- label: "Morph blend",
3385
- type: "range",
3386
- min: 0,
3387
- max: 1,
3388
- step: .01,
3389
- default: .5
3390
- }, pt = new Set([
3391
- "mode",
3392
- "cycles",
3393
- "motionAmp",
3394
- "motionPhase",
3395
- "axis",
3396
- "field"
3397
- ]), mt = {
3398
- mode: "glyphwave",
3399
- cycles: 1,
3400
- phase: .5,
3401
- amp: .3,
3402
- axis: "wght",
3403
- field: "x"
3404
- }, ht = new Set([
3405
- "align",
3406
- "italic",
3407
- "fill",
3408
- "fontSize",
3409
- "vfWght",
3410
- "offsetX",
3411
- "offsetY"
3412
- ]), gt = {
3413
- lineHeight: 0,
3414
- display: "inline-flex",
3415
- alignItems: "center",
3416
- justifyContent: "center"
3417
- }, _t = (e, t) => e ? String.fromCharCode(97 + t.indexOf(e) % 26) : null;
3418
- function vt({ layer: t, setProp: r, updateLayer: a, palette: o, renderAnimate: c, tab: l, tabStrip: d, picker: f = !0 }) {
3419
- let m = n(), h = t.comp ?? {
3420
- bg: "#0b0d12",
3421
- instances: []
3422
- }, g = h.instances ?? [], [v, y] = M(0), b = Math.min(v, Math.max(0, g.length - 1)), x = (e) => {
3423
- y(e), window.dispatchEvent(new CustomEvent("kol:kinetic-element", { detail: {
3424
- id: t.id,
3425
- index: e,
3426
- from: "panel"
3427
- } }));
3428
- };
3429
- he(() => {
3430
- let e = (e) => {
3431
- e.detail?.id === t.id && e.detail.from === "canvas" && y(e.detail.index);
3432
- };
3433
- return window.addEventListener("kol:kinetic-element", e), () => window.removeEventListener("kol:kinetic-element", e);
3434
- }, [t.id]);
3435
- let [C, w] = M([]), ee = (e) => w((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), te = (e) => {
3436
- let t = g[e]?.group;
3437
- return t ? g.reduce((e, n, r) => n.group === t ? [...e, r] : e, []) : [e];
3438
- }, [ne, T] = M(0), E = g[b]?.motions ?? [], D = Math.min(ne, E.length), ie = (e) => ({
3439
- ...e,
3440
- instances: (e.instances ?? []).map((e, t) => t === b ? {
3441
- ...e,
3442
- motion: { ...e.motions?.[D - 1] ?? {} }
3443
- } : e)
3444
- }), oe = (e) => pt.has(e.key) && D > 0 ? ie(h) : h, se = (e) => {
3445
- e && (a(t.id, {
3446
- presetId: e.id,
3447
- presetLabel: e.label,
3448
- comp: Ie(e)
3449
- }), y(0), T(0));
3450
- }, k = (e) => r("comp", e), A = (e) => a(t.id, { comp: {
3451
- ...h,
3452
- instances: e
3453
- } }), le = (e, t) => k({
3454
- ...h,
3455
- instances: g.map((n, r) => r === e ? {
3456
- ...n,
3457
- ...t
3458
- } : n)
3459
- }), ue = () => {
3460
- if (C.length < 2) return;
3461
- let e = new Set(g.map((e) => e.group).filter(Boolean)), t = 1;
3462
- for (; e.has(`g${t}`);) t++;
3463
- A(g.map((e) => C.includes(e.id) ? {
3464
- ...e,
3465
- group: `g${t}`
3466
- } : e)), w([]);
3467
- }, fe = () => {
3468
- C.length && (A(g.map((e) => C.includes(e.id) ? {
3469
- ...e,
3470
- group: null
3471
- } : e)), w([]));
3472
- }, pe = (e, t) => {
3473
- if (pt.has(e.key) && D > 0) {
3474
- let n = e.set(ie(h), t, b).instances?.[b]?.motion ?? {};
3475
- le(b, { motions: E.map((e, t) => t === D - 1 ? n : e) });
3476
- return;
3477
- }
3478
- let n = te(b);
3479
- if (n.length > 1 && ht.has(e.key)) {
3480
- let r = h;
3481
- if (e.key === "fontSize") {
3482
- let i = Number(e.get(h, b)) || 1, a = t / i;
3483
- for (let t of n) {
3484
- let n = Number(e.get(h, t)) || i;
3485
- r = e.set(r, Math.max(8, Math.min(1200, Math.round(n * a))), t);
3486
- }
3487
- } else if (e.key === "offsetX" || e.key === "offsetY") {
3488
- let i = t - (Number(e.get(h, b)) || 0);
3489
- for (let t of n) r = e.set(r, (Number(e.get(h, t)) || 0) + i, t);
3490
- } else for (let i of n) r = e.set(r, t, i);
3491
- k(r);
3492
- return;
3493
- }
3494
- k(e.set(h, t, b));
3495
- }, ge = i(t), _e = () => {
3496
- let e = ge.take();
3497
- a(t.id, {
3498
- comp: dt(h, b, u(e >>> 0)),
3499
- _rollSeed: e
3500
- });
3501
- }, F = () => {
3502
- let e = ge.take(), n = u(e >>> 0), r = h;
3503
- g.forEach((e, t) => {
3504
- r = dt(r, t, n);
3505
- }), a(t.id, {
3506
- comp: r,
3507
- _rollSeed: e
3508
- });
3509
- }, ye = (e, n) => {
3510
- let r = _(e, n);
3511
- a(t.id, {
3512
- themeId: e,
3513
- themeInvert: n,
3514
- comp: {
3515
- ...h,
3516
- bg: r.bg,
3517
- instances: g.map((e) => ({
3518
- ...e,
3519
- fill: r.fg
3520
- }))
3521
- }
3522
- });
3523
- }, I = (e) => k({
3524
- ...h,
3525
- instances: g.map((t) => ({
3526
- ...t,
3527
- fill: e
3528
- }))
3529
- }), be = l === "labs-effect" ? "style" : l, xe = ct.filter((e) => e.tab === be && (!e.when || e.when(oe(e), b))), Se = g.some((e) => e?.morph?.on), L = g[b];
3530
- return /* @__PURE__ */ P(ve, { children: [
3531
- f && /* @__PURE__ */ N(yt, {
3532
- layer: t,
3533
- onPreset: se
3534
- }),
3535
- /* @__PURE__ */ P("div", {
3536
- className: "flex flex-col gap-1",
3537
- children: [
3538
- /* @__PURE__ */ N("span", {
3539
- className: "kol-helper-10 text-meta",
3540
- children: "Elements"
3541
- }),
3542
- /* @__PURE__ */ N(bt, {
3543
- insts: g,
3544
- idx: b,
3545
- onSelect: x,
3546
- onWrite: A,
3547
- marked: C,
3548
- onMark: ee,
3549
- onGroup: ue,
3550
- onUngroup: fe
3551
- }),
3552
- /* @__PURE__ */ N(j, {
3553
- label: "Edit elements on the canvas (click to select, drag to move, corners to scale)",
3554
- children: /* @__PURE__ */ N(O, {
3555
- "aria-label": "Edit elements on the canvas (click to select, drag to move, corners to scale)",
3556
- tone: "primary",
3557
- size: m,
3558
- className: "w-full",
3559
- onClick: () => window.dispatchEvent(new CustomEvent("kol:kinetic-edit", { detail: {
3560
- id: t.id,
3561
- index: b
3562
- } })),
3563
- children: "Edit on canvas"
3564
- })
3565
- })
3566
- ]
3567
- }),
3568
- d,
3569
- (l === "generate" || l === "labs-effect") && /* @__PURE__ */ P(ve, { children: [
3570
- /* @__PURE__ */ N(ae, {
3571
- label: "Text",
3572
- children: /* @__PURE__ */ N(ce, {
3573
- variant: "filled",
3574
- size: m,
3575
- rows: 2,
3576
- axis: "y",
3577
- value: g[b]?.text ?? "",
3578
- onChange: (e) => le(b, { text: e.target.value })
3579
- })
3580
- }),
3581
- /* @__PURE__ */ P("div", {
3582
- className: "grid grid-cols-2 gap-2",
3583
- children: [/* @__PURE__ */ N(ae, {
3584
- label: "Theme",
3585
- children: /* @__PURE__ */ N(re, {
3586
- variant: "subtle",
3587
- size: m,
3588
- className: "w-full",
3589
- options: S,
3590
- value: t.themeId ?? "kol",
3591
- onChange: (e) => ye(e, !!t.themeInvert)
3592
- })
3593
- }), /* @__PURE__ */ N(ae, {
3594
- label: "Invert",
3595
- children: /* @__PURE__ */ N(de, {
3596
- options: [{
3597
- value: "off",
3598
- label: "Off"
3599
- }, {
3600
- value: "on",
3601
- label: "On"
3602
- }],
3603
- viewMode: t.themeInvert ? "on" : "off",
3604
- onViewChange: (e) => ye(t.themeId ?? "kol", e === "on")
3605
- })
3606
- })]
3607
- }),
3608
- /* @__PURE__ */ N(s, {
3609
- label: "Text colour",
3610
- value: g[0]?.fill,
3611
- onChange: (t) => I(e(t, o) ?? t),
3612
- palette: o
3613
- }),
3614
- /* @__PURE__ */ P("div", {
3615
- className: "grid grid-cols-2 gap-2",
3616
- children: [/* @__PURE__ */ N(O, {
3617
- tone: "primary",
3618
- size: m,
3619
- onClick: _e,
3620
- children: "Randomise"
3621
- }), /* @__PURE__ */ N(O, {
3622
- tone: "primary",
3623
- size: m,
3624
- onClick: F,
3625
- children: "All elements"
3626
- })]
3627
- }),
3628
- /* @__PURE__ */ N(p, { seed: ge })
3629
- ] }),
3630
- l === "anim" && /* @__PURE__ */ N(St, {
3631
- motions: E,
3632
- mIdx: D,
3633
- onSelect: T,
3634
- onAdd: () => {
3635
- A(g.map((e, t) => t === b ? {
3636
- ...e,
3637
- motions: [...E, { ...mt }]
3638
- } : e)), T(E.length + 1);
3639
- },
3640
- onRemove: () => {
3641
- D !== 0 && (A(g.map((e, t) => t === b ? {
3642
- ...e,
3643
- motions: E.filter((e, t) => t !== D - 1)
3644
- } : e)), T(D - 1));
3645
- }
3646
- }),
3647
- l !== "generate" && xe.map((e, n) => /* @__PURE__ */ P(me, { children: [
3648
- e.key === "arrangement" && /* @__PURE__ */ P(ve, { children: [/* @__PURE__ */ N("span", {
3649
- className: "kol-helper-10 text-meta",
3650
- children: "OpenType"
3651
- }), /* @__PURE__ */ N(Ct, {
3652
- value: L?.opentype ?? {},
3653
- onToggle: (e, t) => le(b, { opentype: {
3654
- ...L?.opentype ?? {},
3655
- [e]: t
3656
- } })
3657
- })] }),
3658
- e.section && e.section !== xe[n - 1]?.section && /* @__PURE__ */ N("span", {
3659
- className: "kol-helper-10 text-meta",
3660
- children: e.section
3661
- }),
3662
- /* @__PURE__ */ N(xt, {
3663
- knob: e,
3664
- comp: oe(e),
3665
- idx: b,
3666
- palette: o,
3667
- onWrite: pe
3668
- }),
3669
- e.key === "showPath" && L?.path?.type === "custom" && /* @__PURE__ */ N(wt, {
3670
- inst: L,
3671
- layer: t,
3672
- onPoints: (e) => le(b, { path: {
3673
- ...L?.path ?? {},
3674
- points: e
3675
- } })
3676
- })
3677
- ] }, e.key)),
3678
- l === "anim" && Se && /* @__PURE__ */ N(Tt, {
3679
- layer: t,
3680
- setProp: r,
3681
- insts: g,
3682
- renderAnimate: c
3683
- })
3684
- ] });
3685
- }
3686
- function yt({ layer: e, onPreset: t }) {
3687
- return /* @__PURE__ */ N(te, {
3688
- tree: Fe,
3689
- presets: V,
3690
- current: V.find((t) => t.id === e.presetId) ?? V[0],
3691
- onPick: t
3692
- });
3693
- }
3694
- function bt({ insts: e, idx: t, onSelect: r, onWrite: i, marked: a, onMark: o, onGroup: s, onUngroup: c }) {
3695
- let l = n(), u = () => {
3696
- let t = e.length;
3697
- for (; e.some((e) => e.id === `i${t}`);) t++;
3698
- return `i${t}`;
3699
- }, d = () => {
3700
- let n = {
3701
- id: u(),
3702
- text: "Text"
3703
- };
3704
- e[t]?.fill && (n.fill = e[t].fill), i([...e, Ae(n, e.length)]), r(e.length);
3705
- }, f = (t) => {
3706
- let n = {
3707
- ...structuredClone(e[t]),
3708
- id: u()
3709
- }, a = [...e];
3710
- a.splice(t + 1, 0, n), i(a), r(t + 1);
3711
- }, p = (t) => {
3712
- e.length <= 1 || (i(e.filter((e, n) => n !== t)), r(Math.min(t, e.length - 2)));
3713
- }, m = (n) => {
3714
- let a = t + n;
3715
- if (a < 0 || a >= e.length) return;
3716
- let o = [...e], [s] = o.splice(t, 1);
3717
- o.splice(a, 0, s), i(o), r(a);
3718
- }, h = [...new Set(e.map((e) => e.group).filter(Boolean))];
3719
- return /* @__PURE__ */ P(ve, { children: [
3720
- /* @__PURE__ */ N("div", {
3721
- className: "flex flex-col gap-1",
3722
- children: e.map((n, i) => {
3723
- let s = _t(n.group, h);
3724
- return /* @__PURE__ */ P("div", {
3725
- onClick: () => r(i),
3726
- className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${i === t ? "bg-[color-mix(in_srgb,var(--kol-accent-primary)_26%,transparent)] text-emphasis" : "text-body hover:bg-oq-04 hover:text-emphasis"}`,
3727
- children: [
3728
- /* @__PURE__ */ N("span", {
3729
- onClick: (e) => e.stopPropagation(),
3730
- className: "shrink-0",
3731
- style: { lineHeight: 0 },
3732
- children: /* @__PURE__ */ N(ue, {
3733
- checked: a.includes(n.id),
3734
- onChange: () => o(n.id)
3735
- })
3736
- }),
3737
- /* @__PURE__ */ N("span", {
3738
- className: "kol-helper-10 text-meta shrink-0",
3739
- children: i + 1
3740
- }),
3741
- /* @__PURE__ */ N("span", {
3742
- className: "truncate flex-1 min-w-0",
3743
- children: n.text || "—"
3744
- }),
3745
- s && /* @__PURE__ */ P("span", {
3746
- className: "shrink-0 kol-helper-10 text-meta",
3747
- children: ["grp ", s]
3748
- }),
3749
- /* @__PURE__ */ N(j, {
3750
- label: "Duplicate element",
3751
- children: /* @__PURE__ */ N(O, {
3752
- tone: "ghost",
3753
- size: l,
3754
- quiet: !0,
3755
- iconOnly: "copy",
3756
- iconSize: 12,
3757
- "aria-label": "Duplicate element",
3758
- onClick: (e) => {
3759
- e.stopPropagation(), f(i);
3760
- }
3761
- })
3762
- }),
3763
- /* @__PURE__ */ N(j, {
3764
- label: "Remove element",
3765
- children: /* @__PURE__ */ N(O, {
3766
- tone: "ghost",
3767
- size: l,
3768
- quiet: !0,
3769
- iconOnly: "x",
3770
- iconSize: 10,
3771
- "aria-label": "Remove element",
3772
- disabled: e.length <= 1,
3773
- onClick: (e) => {
3774
- e.stopPropagation(), p(i);
3775
- }
3776
- })
3777
- })
3778
- ]
3779
- }, n.id ?? i);
3780
- })
3781
- }),
3782
- /* @__PURE__ */ P("div", {
3783
- className: "grid grid-cols-2 gap-1",
3784
- children: [/* @__PURE__ */ N(O, {
3785
- tone: "primary",
3786
- size: l,
3787
- disabled: a.length < 2,
3788
- onClick: s,
3789
- children: "Group"
3790
- }), /* @__PURE__ */ N(O, {
3791
- tone: "primary",
3792
- size: l,
3793
- disabled: !a.length,
3794
- onClick: c,
3795
- children: "Ungroup"
3796
- })]
3797
- }),
3798
- /* @__PURE__ */ P("div", {
3799
- className: "flex items-center gap-1",
3800
- children: [
3801
- /* @__PURE__ */ N(O, {
3802
- tone: "primary",
3803
- size: l,
3804
- className: "flex-1",
3805
- iconLeft: "plus",
3806
- iconSize: 12,
3807
- onClick: d,
3808
- children: "Add element"
3809
- }),
3810
- /* @__PURE__ */ N(j, {
3811
- label: "Move element up",
3812
- children: /* @__PURE__ */ N(O, {
3813
- tone: "ghost",
3814
- size: l,
3815
- quiet: !0,
3816
- style: gt,
3817
- "aria-label": "Move element up",
3818
- disabled: t <= 0,
3819
- onClick: () => m(-1),
3820
- children: /* @__PURE__ */ N(F, {
3821
- name: "chevron-down",
3822
- size: 12,
3823
- style: { transform: "rotate(180deg)" }
3824
- })
3825
- })
3826
- }),
3827
- /* @__PURE__ */ N(j, {
3828
- label: "Move element down",
3829
- children: /* @__PURE__ */ N(O, {
3830
- tone: "ghost",
3831
- size: l,
3832
- quiet: !0,
3833
- style: gt,
3834
- "aria-label": "Move element down",
3835
- disabled: t >= e.length - 1,
3836
- onClick: () => m(1),
3837
- children: /* @__PURE__ */ N(F, {
3838
- name: "chevron-down",
3839
- size: 12
3840
- })
3841
- })
3842
- })
3843
- ]
3844
- })
3845
- ] });
3846
- }
3847
- function xt({ knob: t, comp: r, idx: i, palette: a, onWrite: o }) {
3848
- let c = n(), l = t.get(r, i), u = (e) => o(t, e);
3849
- if (t.type === "color") return /* @__PURE__ */ N(s, {
3850
- label: t.label,
3851
- value: l,
3852
- onChange: (t) => u(e(t, a) ?? t),
3853
- palette: a
3854
- });
3855
- if (t.type === "select") return /* @__PURE__ */ N(ae, {
3856
- label: t.label,
3857
- children: /* @__PURE__ */ N(re, {
3858
- variant: "subtle",
3859
- size: c,
3860
- className: "w-full",
3861
- options: lt(t, r, i),
3862
- value: l,
3863
- onChange: u
3864
- })
3865
- });
3866
- let { min: d, max: f } = ut(t, r, i);
3867
- return /* @__PURE__ */ N(ae, {
3868
- label: t.label,
3869
- children: /* @__PURE__ */ N(A, {
3870
- min: d,
3871
- max: f,
3872
- step: t.step ?? 1,
3873
- value: typeof l == "number" ? l : d,
3874
- onChange: u
3875
- })
3876
- });
3877
- }
3878
- function St({ motions: e, mIdx: t, onSelect: r, onAdd: i, onRemove: a }) {
3879
- let o = n(), s = [{
3880
- value: "0",
3881
- label: "1"
3882
- }, ...e.map((e, t) => ({
3883
- value: String(t + 1),
3884
- label: String(t + 2)
3885
- }))];
3886
- return /* @__PURE__ */ P("div", {
3887
- className: "flex flex-col gap-1",
3888
- children: [/* @__PURE__ */ N("span", {
3889
- className: "kol-helper-10 text-meta",
3890
- children: "Motion layers"
3891
- }), /* @__PURE__ */ P("div", {
3892
- className: "flex items-center gap-1",
3893
- children: [
3894
- /* @__PURE__ */ N("div", {
3895
- className: "flex-1 min-w-0",
3896
- children: /* @__PURE__ */ N(k, {
3897
- variant: "filled",
3898
- value: String(t),
3899
- onChange: (e) => r(Number(e)),
3900
- options: s
3901
- })
3902
- }),
3903
- /* @__PURE__ */ N(j, {
3904
- label: "Add motion layer",
3905
- children: /* @__PURE__ */ N(O, {
3906
- tone: "ghost",
3907
- size: o,
3908
- quiet: !0,
3909
- iconOnly: "plus",
3910
- iconSize: 12,
3911
- "aria-label": "Add motion layer",
3912
- onClick: i
3913
- })
3914
- }),
3915
- /* @__PURE__ */ N(j, {
3916
- label: "Remove motion layer (the primary can only be set to None)",
3917
- children: /* @__PURE__ */ N(O, {
3918
- tone: "ghost",
3919
- size: o,
3920
- quiet: !0,
3921
- iconOnly: "x",
3922
- iconSize: 10,
3923
- "aria-label": "Remove motion layer",
3924
- disabled: t === 0,
3925
- onClick: a
3926
- })
3927
- })
3928
- ]
3929
- })]
3930
- });
3931
- }
3932
- function Ct({ value: e = {}, onToggle: t }) {
3933
- let [n, r] = M(!1), i = pe({
3934
- open: n,
3935
- onOpenChange: r,
3936
- placement: "bottom-start",
3937
- offset: -1,
3938
- flip: !1,
3939
- matchReferenceWidth: !0,
3940
- role: "listbox"
3941
- }), a = Ue.filter((t) => e[t.tag]).length;
3942
- return /* @__PURE__ */ P("div", {
3943
- className: "relative w-full",
3944
- children: [/* @__PURE__ */ P("button", {
3945
- ref: i.refs.setReference,
3946
- ...i.getReferenceProps(),
3947
- type: "button",
3948
- className: "w-full flex items-center justify-between kol-helper-12 rounded",
3949
- style: {
3950
- border: "1px solid transparent",
3951
- borderRadius: n ? "4px 4px 0 0" : "4px",
3952
- backgroundColor: "var(--kol-surface-secondary)",
3953
- color: "var(--kol-surface-on-primary)",
3954
- padding: "4px 12px",
3955
- cursor: "pointer"
3956
- },
3957
- "aria-haspopup": "listbox",
3958
- "aria-expanded": n,
3959
- children: [/* @__PURE__ */ N("span", { children: a ? `${a} feature${a > 1 ? "s" : ""}` : "None" }), /* @__PURE__ */ N(F, {
3960
- name: "chevron-down",
3961
- size: 10,
3962
- className: "ml-auto",
3963
- style: {
3964
- transform: n ? "rotate(180deg)" : "rotate(0deg)",
3965
- transition: "transform 300ms"
3966
- }
3967
- })]
3968
- }), /* @__PURE__ */ N(se, {
3969
- popover: i,
3970
- panel: !1,
3971
- focus: !1,
3972
- style: {
3973
- backgroundColor: "var(--kol-surface-secondary)",
3974
- color: "var(--kol-surface-on-primary)",
3975
- borderRadius: "0 0 4px 4px",
3976
- zIndex: 200
3977
- },
3978
- children: /* @__PURE__ */ N("div", {
3979
- className: "flex max-h-[300px] flex-col items-stretch overflow-y-auto",
3980
- role: "listbox",
3981
- children: Ue.map((n) => /* @__PURE__ */ N(oe, {
3982
- onClick: () => t(n.tag, !e[n.tag]),
3983
- shortcut: e[n.tag] ? /* @__PURE__ */ N(F, {
3984
- name: "check",
3985
- size: 11
3986
- }) : void 0,
3987
- children: n.label
3988
- }, n.tag))
3989
- })
3990
- })]
3991
- });
3992
- }
3993
- function wt({ inst: e, layer: t, onPoints: r }) {
3994
- let i = n(), a = _e(null), o = _e(null), s = e?.path?.points, c = Array.isArray(s) && s.length >= 2 ? s : xe, l = t.w > 0 && t.h > 0 ? t.w / t.h : 1, u = Ee("custom", 100, 100, { points: c }).d, d = (e) => (t) => {
3995
- t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture(t.pointerId), o.current = { i: e };
3996
- }, f = (e) => {
3997
- let t = o.current, n = a.current;
3998
- if (!t || !n) return;
3999
- let i = n.getBoundingClientRect();
4000
- if (!i.width || !i.height) return;
4001
- let s = Math.max(0, Math.min(1, (e.clientX - i.left) / i.width)), l = Math.max(0, Math.min(1, (e.clientY - i.top) / i.height));
4002
- r(c.map((e, n) => n === t.i ? [Number(s.toFixed(3)), Number(l.toFixed(3))] : e));
4003
- }, p = (e) => {
4004
- o.current = null;
4005
- try {
4006
- e.currentTarget.releasePointerCapture(e.pointerId);
4007
- } catch {}
4008
- };
4009
- return /* @__PURE__ */ P("div", {
4010
- className: "flex flex-col gap-2",
4011
- children: [/* @__PURE__ */ P("div", {
4012
- ref: a,
4013
- className: "relative w-full rounded border border-oq-08 overflow-hidden",
4014
- style: { aspectRatio: `${l}` },
4015
- children: [/* @__PURE__ */ N("svg", {
4016
- className: "absolute inset-0 w-full h-full",
4017
- viewBox: "0 0 100 100",
4018
- preserveAspectRatio: "none",
4019
- children: /* @__PURE__ */ N("path", {
4020
- d: u,
4021
- fill: "none",
4022
- stroke: "var(--kol-accent-primary)",
4023
- strokeWidth: 1.5,
4024
- vectorEffect: "non-scaling-stroke"
4025
- })
4026
- }), c.map((e, t) => /* @__PURE__ */ N("div", {
4027
- onPointerDown: d(t),
4028
- onPointerMove: f,
4029
- onPointerUp: p,
4030
- className: "absolute cursor-grab rounded-full",
4031
- style: {
4032
- left: `${e[0] * 100}%`,
4033
- top: `${e[1] * 100}%`,
4034
- width: 12,
4035
- height: 12,
4036
- marginLeft: -6,
4037
- marginTop: -6,
4038
- background: "var(--kol-accent-primary)",
4039
- border: "2px solid white",
4040
- boxShadow: "0 0 0 1px rgba(0,0,0,0.5)"
4041
- }
4042
- }, t))]
4043
- }), /* @__PURE__ */ P("div", {
4044
- className: "grid grid-cols-2 gap-2",
4045
- children: [/* @__PURE__ */ N(O, {
4046
- tone: "primary",
4047
- size: i,
4048
- onClick: () => r([...c, [.5, .5]]),
4049
- children: "Add point"
4050
- }), /* @__PURE__ */ N(O, {
4051
- tone: "primary",
4052
- size: i,
4053
- disabled: c.length <= 2,
4054
- onClick: () => r(c.slice(0, -1)),
4055
- children: "Remove point"
4056
- })]
4057
- })]
4058
- });
4059
- }
4060
- function Tt({ layer: e, setProp: t, insts: n, renderAnimate: r }) {
4061
- let i = ft, a = e[i.key], o = f(a), s = n.find((e) => e?.morph?.on)?.morph?.blend ?? i.default, c = typeof a == "number" ? a : s, l = o ? /* @__PURE__ */ N("div", {
4062
- className: "kol-helper-12 text-meta italic px-1",
4063
- children: "animated"
4064
- }) : /* @__PURE__ */ N(A, {
4065
- min: i.min,
4066
- max: i.max,
4067
- step: i.step,
4068
- value: c,
4069
- onChange: (e) => t(i.key, e)
4070
- });
4071
- return /* @__PURE__ */ N(ae, {
4072
- label: i.label,
4073
- children: /* @__PURE__ */ P("div", {
4074
- className: "flex items-center gap-2",
4075
- children: [/* @__PURE__ */ N("div", {
4076
- className: "flex-1 min-w-0",
4077
- children: l
4078
- }), r(i)]
4079
- })
4080
- });
4081
- }
4082
- //#endregion
4083
- //#region src/editor/params/TimelineDock.jsx
4084
- function Et(e, t = []) {
4085
- for (let n of e) {
4086
- for (let e in n) {
4087
- let r = n[e];
4088
- f(r) && r.bind === "track" && t.push({
4089
- id: `${n.id}:${e}`,
4090
- layerId: n.id,
4091
- key: e,
4092
- label: `${D(n)} · ${e}`,
4093
- keys: r.keys
4094
- });
4095
- }
4096
- Array.isArray(n.children) && Et(n.children, t);
4097
- }
4098
- return t;
4099
- }
4100
- function Dt() {
4101
- let { layers: e, updateLayer: n } = l(), { t: r, seek: i } = t(), a = ge(() => Et(e), [e]);
4102
- return /* @__PURE__ */ N(le, {
4103
- tracks: a,
4104
- t: r,
4105
- onSeek: i,
4106
- onChange: (e, t) => {
4107
- let r = a.find((t) => t.id === e);
4108
- r && n(r.layerId, { [r.key]: {
4109
- bind: "track",
4110
- keys: t
4111
- } });
4112
- },
4113
- easingOptions: h
4114
- });
4115
- }
4116
- //#endregion
4117
- //#region src/editor/params/TransportBar.jsx
4118
- function Ot({ seconds: e, onCommit: t, size: n }) {
4119
- let r = String(e), [i, a] = M(r), [o, s] = M(!1);
4120
- return he(() => {
4121
- o || a(r);
4122
- }, [r, o]), /* @__PURE__ */ N(j, {
4123
- label: "Loop length",
4124
- triggerClassName: "flex w-full",
4125
- children: /* @__PURE__ */ N(ie, {
4126
- type: "text",
4127
- inputMode: "decimal",
4128
- variant: "property",
4129
- size: n,
4130
- affordance: "Loop /",
4131
- unit: "s",
4132
- chars: 3,
4133
- "aria-label": "Loop length in seconds",
4134
- value: i,
4135
- onFocus: (e) => {
4136
- s(!0), e.target.select();
4137
- },
4138
- onChange: (e) => a(e.target.value),
4139
- onBlur: () => {
4140
- s(!1);
4141
- let e = Number(i.trim());
4142
- if (i.trim() === "" || !Number.isFinite(e)) {
4143
- a(r);
4144
- return;
4145
- }
4146
- t(e);
4147
- },
4148
- onKeyDown: (e) => {
4149
- e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (a(r), s(!1), e.currentTarget.blur());
4150
- },
4151
- inputClassName: "text-center"
4152
- })
4153
- });
4154
- }
4155
- var kt = (e, t) => /* @__PURE__ */ N(F, {
4156
- name: e,
4157
- size: fe(t, !0)
4158
- }), At = {
4159
- sm: "shrink-0 [&_.kol-seg-cell]:flex-none [&_.kol-seg-cell]:px-0 [&_.kol-seg-cell]:w-[var(--kol-ctl-sm)]",
4160
- md: "shrink-0 [&_.kol-seg-cell]:flex-none [&_.kol-seg-cell]:px-0 [&_.kol-seg-cell]:w-[var(--kol-ctl-md)]",
4161
- lg: "shrink-0 [&_.kol-seg-cell]:flex-none [&_.kol-seg-cell]:px-0 [&_.kol-seg-cell]:w-[var(--kol-ctl-lg)]"
4162
- };
4163
- function jt({ size: e = "sm" }) {
4164
- let { playing: n, loopSeconds: r, play: i, pause: a, stop: o, rewind: s, setLoopSeconds: c } = t();
4165
- return /* @__PURE__ */ P("div", {
4166
- className: "flex items-center gap-2",
4167
- children: [
4168
- /* @__PURE__ */ N(k, {
4169
- size: e,
4170
- ariaLabel: "Playback",
4171
- value: n ? "play" : "pause",
4172
- className: At[e],
4173
- onChange: (e) => e === "play" ? i() : a(),
4174
- options: [{
4175
- value: "play",
4176
- ariaLabel: "Play",
4177
- tooltip: "Play (Space)",
4178
- label: kt("play", e)
4179
- }, {
4180
- value: "pause",
4181
- ariaLabel: "Pause",
4182
- tooltip: "Pause (Space)",
4183
- label: kt("pause", e)
4184
- }]
4185
- }),
4186
- /* @__PURE__ */ N("div", {
4187
- className: "flex-1 min-w-0",
4188
- children: /* @__PURE__ */ N(Ot, {
4189
- seconds: r,
4190
- onCommit: c,
4191
- size: e
4192
- })
4193
- }),
4194
- /* @__PURE__ */ N(k, {
4195
- size: e,
4196
- ariaLabel: "Reset",
4197
- value: null,
4198
- className: At[e],
4199
- onChange: (e) => e === "stop" ? o() : s(),
4200
- options: [{
4201
- value: "stop",
4202
- ariaLabel: "Stop",
4203
- label: kt("stop", e)
4204
- }, {
4205
- value: "rewind",
4206
- ariaLabel: "Rewind",
4207
- label: kt("rewind", e)
4208
- }]
4209
- })
4210
- ]
4211
- });
4212
- }
4213
- //#endregion
4214
- //#region src/packs/motion.js
4215
- var Mt = {
4216
- layerTypes: ["kinetic"],
4217
- kineticPresetById: Ne,
4218
- presetComp: Ie,
4219
- KineticType: Je,
4220
- loadFonts: ee,
4221
- warmFontCss: x,
4222
- kineticFontCss: y,
4223
- KineticPanel: vt,
4224
- TimelineDock: Dt,
4225
- TransportBar: jt
4226
- };
4227
- r("motion", Mt);
4228
- //#endregion
4229
- export { V as a, dt as i, Dt as n, Fe as o, vt as r, Ie as s, Mt as t };