@wave3d/core 0.5.0 → 0.7.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.
Files changed (39) hide show
  1. package/README.md +2 -6
  2. package/dist/config/model.d.ts +97 -9
  3. package/dist/config/model.js +165 -61
  4. package/dist/config/model.js.map +1 -1
  5. package/dist/core-loader.d.ts +0 -2
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +2 -2
  8. package/dist/presets.d.ts +8 -3
  9. package/dist/presets.js +542 -1
  10. package/dist/presets.js.map +1 -1
  11. package/dist/renderer/WaveGeometry.d.ts +22 -4
  12. package/dist/renderer/WaveGeometry.js +22 -3
  13. package/dist/renderer/WaveGeometry.js.map +1 -1
  14. package/dist/renderer/WaveRenderer.d.ts +22 -2
  15. package/dist/renderer/WaveRenderer.js +118 -3
  16. package/dist/renderer/WaveRenderer.js.map +1 -1
  17. package/dist/renderer/heroPalette.d.ts +0 -1
  18. package/dist/renderer/interaction.d.ts +0 -2
  19. package/dist/renderer/interaction.js +9 -0
  20. package/dist/renderer/interaction.js.map +1 -1
  21. package/dist/renderer/palette.d.ts +1 -2
  22. package/dist/renderer/palette.js +7 -5
  23. package/dist/renderer/palette.js.map +1 -1
  24. package/dist/renderer/particleField.d.ts +50 -0
  25. package/dist/renderer/particleField.js +220 -0
  26. package/dist/renderer/particleField.js.map +1 -0
  27. package/dist/renderer/shaders.js +271 -67
  28. package/dist/renderer/shaders.js.map +1 -1
  29. package/dist/shell/createWave.d.ts +0 -1
  30. package/dist/standalone/wave3d.standalone.js +2868 -1950
  31. package/dist/standalone.d.ts +2 -3
  32. package/dist/standalone.js +2 -2
  33. package/dist/studio/StudioWaveRenderer.d.ts +0 -1
  34. package/dist/studio/randomize.d.ts +0 -1
  35. package/dist/studio/thumbnail.d.ts +2 -3
  36. package/dist/studio/thumbnail.js +16 -3
  37. package/dist/studio/thumbnail.js.map +1 -1
  38. package/package.json +9 -5
  39. package/skills/wave3d/SKILL.md +30 -12
package/dist/presets.js CHANGED
@@ -6,6 +6,100 @@ import { createDefaultConfig, makeStops, makeWaveSpread } from "./config/model.j
6
6
  * "Stripe *" display names) on top; see apps/studio/src/presets.ts.
7
7
  */
8
8
  const RAD = 180 / Math.PI;
9
+ /**
10
+ * Reusable particle STYLES applied to a wave's `particles` block. Surfaced in the studio's per-wave
11
+ * Particles folder (the "style" picker) and used by the "Particle Zoo" showcase preset. Each is a dust
12
+ * look independent of the wave it rides — clone before mutating (`structuredClone`).
13
+ */
14
+ const PARTICLE_PRESETS = {
15
+ Glitter: {
16
+ count: 16e3,
17
+ size: 2.6,
18
+ seed: 7,
19
+ color: "#ffdca8",
20
+ shape: "glitter",
21
+ edgeBias: 1,
22
+ drift: 300,
23
+ bias: -.6,
24
+ twinkle: .8
25
+ },
26
+ Embers: {
27
+ count: 16e3,
28
+ size: 3.6,
29
+ seed: 7,
30
+ color: "#ff8a2c",
31
+ color2: "#ffe19a",
32
+ shape: "soft",
33
+ edgeBias: .15,
34
+ drift: 40,
35
+ rise: 320,
36
+ wander: 120,
37
+ twinkle: .85,
38
+ life: 6
39
+ },
40
+ Snow: {
41
+ count: 12e3,
42
+ size: 3,
43
+ seed: 4,
44
+ color: "#eef4ff",
45
+ color2: "#bcd0ee",
46
+ shape: "soft",
47
+ edgeBias: .1,
48
+ drift: 20,
49
+ rise: -260,
50
+ wander: 80,
51
+ twinkle: .5,
52
+ life: 8
53
+ },
54
+ Sparks: {
55
+ count: 9e3,
56
+ size: 5,
57
+ seed: 9,
58
+ color: "#ffd27a",
59
+ color2: "#fff4d0",
60
+ shape: "streak",
61
+ edgeBias: 1,
62
+ drift: 620,
63
+ rise: 90,
64
+ wander: 20,
65
+ bias: -.4,
66
+ twinkle: .9,
67
+ life: 2.5
68
+ },
69
+ Fireflies: {
70
+ count: 2200,
71
+ size: 5,
72
+ seed: 11,
73
+ color: "#dfff9a",
74
+ color2: "#8fd94a",
75
+ shape: "star",
76
+ edgeBias: .1,
77
+ drift: 25,
78
+ swirl: .3,
79
+ wander: 170,
80
+ twinkle: 1,
81
+ life: 5
82
+ },
83
+ Bubbles: {
84
+ count: 3e3,
85
+ size: 7,
86
+ sizeJitter: .9,
87
+ seed: 6,
88
+ color: "#cdeefb",
89
+ color2: "#8fd0e6",
90
+ shape: "ring",
91
+ edgeBias: .2,
92
+ drift: 30,
93
+ rise: 240,
94
+ wander: 60,
95
+ twinkle: .3,
96
+ life: 7
97
+ }
98
+ };
99
+ /** Degrees → radians (for the Particle Zoo's per-wave rotation, authored in degrees). */
100
+ const rad = (deg) => deg * Math.PI / 180;
101
+ /** Clamp a signed magnitude to ±m (used to cap the Zoo's long-range particle motion terms). */
102
+ const capMag = (v, m) => v == null ? v : Math.sign(v) * Math.min(Math.abs(v), m);
9
103
  /** Build a preset from a set of wave parameters. rotation/hue are given in RADIANS and
10
104
  * converted to degrees. All presets are solid-theme, so they reuse the hero palette +
11
105
  * surfaceColor fibers (600/0.2) and sheen 0, like the hero. camTarget/zoom frame the
@@ -350,6 +444,348 @@ const PRESETS = {
350
444
  c.transparentBackground = false;
351
445
  return c;
352
446
  },
447
+ "Latte Ring": () => {
448
+ const c = PRESETS["Hero"]();
449
+ const w = c.waves[0];
450
+ w.radialAmount = .72;
451
+ w.radialArc = 286;
452
+ w.radialCenter = -160;
453
+ w.radialRadius = 300;
454
+ w.radialSpread = 1.47;
455
+ w.rotation = {
456
+ x: 0,
457
+ y: 0,
458
+ z: 0
459
+ };
460
+ w.position = {
461
+ x: -280,
462
+ y: -320,
463
+ z: 0
464
+ };
465
+ w.scale = {
466
+ x: 1.12,
467
+ y: 1.12,
468
+ z: 1.12
469
+ };
470
+ w.opacity = .5;
471
+ w.displaceFrequency = {
472
+ x: .0026,
473
+ y: .0048
474
+ };
475
+ w.displaceAmount = 101.73;
476
+ w.detailAmount = 6;
477
+ w.detailFrequency = .1;
478
+ w.speed = .21;
479
+ w.fiberCount = 110;
480
+ w.fiberStrength = .95;
481
+ w.creaseLight = .55;
482
+ w.edgeFeather = .34;
483
+ w.noiseBands = [{
484
+ startX: 0,
485
+ endX: 1,
486
+ startY: .5,
487
+ endY: 1,
488
+ feather: .4,
489
+ strength: 1,
490
+ frequency: 300,
491
+ colorAttenuation: .85,
492
+ parabolaPower: 2.5
493
+ }];
494
+ w.usePaletteTexture = false;
495
+ w.gradientType = "mesh";
496
+ w.meshGradientSoftness = .7;
497
+ w.meshGradientPoints = [
498
+ {
499
+ color: "#f3c06a",
500
+ x: .5,
501
+ y: .1,
502
+ influence: .7
503
+ },
504
+ {
505
+ color: "#f9edd4",
506
+ x: .34,
507
+ y: .36,
508
+ influence: .62
509
+ },
510
+ {
511
+ color: "#e6923a",
512
+ x: .15,
513
+ y: .55,
514
+ influence: .5
515
+ },
516
+ {
517
+ color: "#f1d49a",
518
+ x: .82,
519
+ y: .42,
520
+ influence: .55
521
+ },
522
+ {
523
+ color: "#ece7d8",
524
+ x: .58,
525
+ y: .88,
526
+ influence: .72
527
+ }
528
+ ];
529
+ w.blendMode = "normal";
530
+ w.hueShift = 0;
531
+ w.colorContrast = 1.05;
532
+ w.colorSaturation = 1.15;
533
+ c.cameraDistance = 600;
534
+ c.cameraPosition = {
535
+ x: -854.327,
536
+ y: 135.331,
537
+ z: 478.048
538
+ };
539
+ c.cameraTarget = {
540
+ x: -720.043,
541
+ y: 10.575,
542
+ z: -93.27
543
+ };
544
+ c.cameraZoom = 1.222;
545
+ c.background = "#050404";
546
+ c.backgroundMode = "color";
547
+ c.transparentBackground = false;
548
+ c.grain = .25;
549
+ c.blur = 0;
550
+ c.bloomStrength = .18;
551
+ c.bloomRadius = .55;
552
+ c.bloomThreshold = .72;
553
+ w.particles = {
554
+ count: 2e4,
555
+ size: 2.9,
556
+ color: "#ffdca8",
557
+ seed: 7,
558
+ twinkle: .8,
559
+ edgeBias: 1,
560
+ drift: 490,
561
+ bias: -.6
562
+ };
563
+ return c;
564
+ },
565
+ "Particle Zoo": () => {
566
+ const c = createDefaultConfig();
567
+ c.background = "#05070d";
568
+ c.backgroundMode = "color";
569
+ c.transparentBackground = false;
570
+ c.grain = .26;
571
+ c.blur = 0;
572
+ c.bloomStrength = .3;
573
+ c.bloomThreshold = .66;
574
+ c.cameraPosition = {
575
+ x: 100,
576
+ y: 0,
577
+ z: 5e3
578
+ };
579
+ c.cameraTarget = {
580
+ x: 0,
581
+ y: 0,
582
+ z: 0
583
+ };
584
+ c.cameraZoom = .6;
585
+ const zoo = [
586
+ {
587
+ style: "Embers",
588
+ palette: [
589
+ "#ff7a1e",
590
+ "#ffd27a",
591
+ "#c23a12"
592
+ ],
593
+ pos: [-720, 285],
594
+ scale: [
595
+ 1,
596
+ 1,
597
+ 1
598
+ ],
599
+ rot: [
600
+ -20,
601
+ 0,
602
+ -14
603
+ ],
604
+ opacity: .72,
605
+ shape: {
606
+ displaceFrequency: {
607
+ x: .0024,
608
+ y: .0065
609
+ },
610
+ displaceAmount: 118,
611
+ twistPower: {
612
+ x: 2.4,
613
+ y: 2.4,
614
+ z: 3.2
615
+ }
616
+ }
617
+ },
618
+ {
619
+ style: "Snow",
620
+ palette: [
621
+ "#8fb8e8",
622
+ "#e8f1fb",
623
+ "#aeb9d6"
624
+ ],
625
+ pos: [700, 320],
626
+ scale: [
627
+ 1.1,
628
+ 1,
629
+ .9
630
+ ],
631
+ rot: [
632
+ -62,
633
+ 0,
634
+ 12
635
+ ],
636
+ opacity: .72,
637
+ shape: {
638
+ displaceFrequency: {
639
+ x: .006,
640
+ y: .013
641
+ },
642
+ displaceAmount: 22,
643
+ twistPower: {
644
+ x: .8,
645
+ y: .8,
646
+ z: 1
647
+ }
648
+ }
649
+ },
650
+ {
651
+ style: "Sparks",
652
+ palette: [
653
+ "#ffd27a",
654
+ "#fff4d0",
655
+ "#c8853a"
656
+ ],
657
+ pos: [0, -30],
658
+ scale: [
659
+ .85,
660
+ .85,
661
+ .85
662
+ ],
663
+ rot: [
664
+ 0,
665
+ 0,
666
+ 0
667
+ ],
668
+ opacity: .32,
669
+ shape: {
670
+ radialAmount: .82,
671
+ radialArc: 118,
672
+ radialCenter: 90,
673
+ radialRadius: 40,
674
+ radialSpread: 1,
675
+ displaceAmount: 30
676
+ }
677
+ },
678
+ {
679
+ style: "Fireflies",
680
+ palette: [
681
+ "#3d5a24",
682
+ "#7bd23a",
683
+ "#40521f"
684
+ ],
685
+ pos: [-560, -300],
686
+ scale: [
687
+ 1.25,
688
+ 1.25,
689
+ 1.25
690
+ ],
691
+ rot: [
692
+ 0,
693
+ 0,
694
+ 8
695
+ ],
696
+ opacity: .72,
697
+ shape: {
698
+ helixTurns: 3,
699
+ helixRadius: 44,
700
+ helixRoll: 1,
701
+ displaceAmount: 8,
702
+ twistPower: {
703
+ x: 1,
704
+ y: 1,
705
+ z: 1.2
706
+ }
707
+ }
708
+ },
709
+ {
710
+ style: "Bubbles",
711
+ palette: [
712
+ "#2e8fb0",
713
+ "#7fd4e8",
714
+ "#1a5a6e"
715
+ ],
716
+ pos: [660, -270],
717
+ scale: [
718
+ 1,
719
+ 1.15,
720
+ 1
721
+ ],
722
+ rot: [
723
+ -16,
724
+ 0,
725
+ -20
726
+ ],
727
+ opacity: .72,
728
+ shape: {
729
+ displaceFrequency: {
730
+ x: .005,
731
+ y: .011
732
+ },
733
+ displaceAmount: 46,
734
+ twistFrequency: {
735
+ x: -.06,
736
+ y: .09,
737
+ z: -.5
738
+ },
739
+ twistPower: {
740
+ x: 4,
741
+ y: 6,
742
+ z: 9
743
+ }
744
+ }
745
+ }
746
+ ];
747
+ const base = c.waves[0];
748
+ c.waves = zoo.map((z, i) => {
749
+ const w = structuredClone(base);
750
+ w.usePaletteTexture = false;
751
+ w.gradientType = "linear";
752
+ w.gradientAngle = 0;
753
+ w.palette = makeStops(z.palette);
754
+ w.blendMode = "normal";
755
+ w.hueShift = 0;
756
+ w.colorContrast = 1;
757
+ w.colorSaturation = 1.1;
758
+ w.opacity = z.opacity;
759
+ w.scale = {
760
+ x: z.scale[0],
761
+ y: z.scale[1],
762
+ z: z.scale[2]
763
+ };
764
+ w.rotation = {
765
+ x: rad(z.rot[0]),
766
+ y: rad(z.rot[1]),
767
+ z: rad(z.rot[2])
768
+ };
769
+ w.position = {
770
+ x: z.pos[0],
771
+ y: z.pos[1],
772
+ z: 0
773
+ };
774
+ w.seed = i * 7;
775
+ w.speed = .05;
776
+ Object.assign(w, z.shape);
777
+ const p = structuredClone(PARTICLE_PRESETS[z.style]);
778
+ const PULL = .13;
779
+ if (p.drift != null) p.drift = capMag(p.drift * PULL, 24);
780
+ if (p.rise != null) p.rise = capMag(p.rise * PULL, 28);
781
+ if (p.wander != null) p.wander = capMag(p.wander * PULL, 15);
782
+ if (p.swirl != null) p.swirl = capMag(p.swirl * PULL, .05);
783
+ w.particles = p;
784
+ return w;
785
+ });
786
+ c.waveCount = c.waves.length;
787
+ return c;
788
+ },
353
789
  Holographic: () => {
354
790
  const c = PRESETS["Hero"]();
355
791
  const w = c.waves[0];
@@ -541,6 +977,111 @@ const PRESETS = {
541
977
  c.transparentBackground = false;
542
978
  return c;
543
979
  },
980
+ Corkscrew: () => {
981
+ const c = PRESETS["Hero"]();
982
+ const w = c.waves[0];
983
+ w.helixTurns = 5;
984
+ w.helixRadius = 45;
985
+ w.helixRoll = 1;
986
+ w.helixPhase = 0;
987
+ w.twistFrequency = {
988
+ x: 0,
989
+ y: 0,
990
+ z: 0
991
+ };
992
+ w.twistPower = {
993
+ x: 4,
994
+ y: 4,
995
+ z: 2
996
+ };
997
+ w.displaceAmount = 16;
998
+ w.displaceFrequency = {
999
+ x: .006,
1000
+ y: 8e-4
1001
+ };
1002
+ w.speed = .1;
1003
+ w.position = {
1004
+ x: 0,
1005
+ y: 0,
1006
+ z: 0
1007
+ };
1008
+ w.rotation = {
1009
+ x: 0,
1010
+ y: 0,
1011
+ z: 12
1012
+ };
1013
+ w.scale = {
1014
+ x: 3,
1015
+ y: 3,
1016
+ z: 1.5
1017
+ };
1018
+ w.gradientType = "mesh";
1019
+ w.meshGradientPoints = [
1020
+ {
1021
+ color: "#0a84ff",
1022
+ x: .06,
1023
+ y: .9,
1024
+ influence: .68
1025
+ },
1026
+ {
1027
+ color: "#64d2ff",
1028
+ x: .88,
1029
+ y: .92,
1030
+ influence: .72
1031
+ },
1032
+ {
1033
+ color: "#bf5af2",
1034
+ x: .5,
1035
+ y: .64,
1036
+ influence: .58
1037
+ },
1038
+ {
1039
+ color: "#ff375f",
1040
+ x: .1,
1041
+ y: .14,
1042
+ influence: .7
1043
+ },
1044
+ {
1045
+ color: "#ff9f0a",
1046
+ x: .84,
1047
+ y: .12,
1048
+ influence: .74
1049
+ },
1050
+ {
1051
+ color: "#30d158",
1052
+ x: .94,
1053
+ y: .5,
1054
+ influence: .54
1055
+ }
1056
+ ];
1057
+ w.meshGradientSoftness = .68;
1058
+ w.blendMode = "normal";
1059
+ w.hueShift = 0;
1060
+ w.colorContrast = 1.06;
1061
+ w.colorSaturation = 1.12;
1062
+ w.fiberStrength = .14;
1063
+ c.cameraPosition = {
1064
+ x: -526.009,
1065
+ y: -285.284,
1066
+ z: -425.489
1067
+ };
1068
+ c.cameraTarget = {
1069
+ x: -95.046,
1070
+ y: -17.053,
1071
+ z: -105.608
1072
+ };
1073
+ c.cameraDistance = 600;
1074
+ c.cameraZoom = 1.176;
1075
+ c.grain = .3;
1076
+ c.blur = .008;
1077
+ c.bloomStrength = .35;
1078
+ c.bloomRadius = .6;
1079
+ c.bloomThreshold = .55;
1080
+ c.background = "#070914";
1081
+ c.backgroundMode = "color";
1082
+ c.transparentBackground = false;
1083
+ return c;
1084
+ },
544
1085
  Kaleidoscope: () => {
545
1086
  const c = PRESETS["Wave 3"]();
546
1087
  const w = c.waves[0];
@@ -554,6 +1095,6 @@ const PRESETS = {
554
1095
  }
555
1096
  };
556
1097
  //#endregion
557
- export { PRESETS };
1098
+ export { PARTICLE_PRESETS, PRESETS };
558
1099
 
559
1100
  //# sourceMappingURL=presets.js.map