@3driseai/3drise-viewer 0.1.4 → 0.1.6

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 (196) hide show
  1. package/README.md +225 -0
  2. package/dist/components/AdvancedGrid.d.ts +16 -0
  3. package/dist/components/AdvancedGrid.d.ts.map +1 -0
  4. package/dist/components/AdvancedGrid.js +63 -0
  5. package/dist/components/AnimatedObject.d.ts.map +1 -1
  6. package/dist/components/AnimatedObject.js +6 -4
  7. package/dist/components/CameraController.d.ts.map +1 -1
  8. package/dist/components/CameraController.js +0 -6
  9. package/dist/components/CircuitGrid.d.ts +22 -0
  10. package/dist/components/CircuitGrid.d.ts.map +1 -0
  11. package/dist/components/CircuitGrid.js +69 -0
  12. package/dist/components/Clouds.d.ts.map +1 -1
  13. package/dist/components/Clouds.js +0 -5
  14. package/dist/components/ContourGrid.d.ts +25 -0
  15. package/dist/components/ContourGrid.d.ts.map +1 -0
  16. package/dist/components/ContourGrid.js +74 -0
  17. package/dist/components/CreatedObject.d.ts.map +1 -1
  18. package/dist/components/CreatedObject.js +3 -6
  19. package/dist/components/CustomPrimitive.d.ts.map +1 -1
  20. package/dist/components/CustomPrimitive.js +0 -5
  21. package/dist/components/EffectsGenerator.d.ts.map +1 -1
  22. package/dist/components/EffectsGenerator.js +0 -2
  23. package/dist/components/EffectsGroup.d.ts +6 -0
  24. package/dist/components/EffectsGroup.d.ts.map +1 -1
  25. package/dist/components/EffectsGroup.js +14 -4
  26. package/dist/components/FractalGrid.d.ts +23 -0
  27. package/dist/components/FractalGrid.d.ts.map +1 -0
  28. package/dist/components/FractalGrid.js +72 -0
  29. package/dist/components/Frame.d.ts.map +1 -1
  30. package/dist/components/Frame.js +2 -3
  31. package/dist/components/GalleryLayout.d.ts.map +1 -1
  32. package/dist/components/GalleryLayout.js +0 -3
  33. package/dist/components/GeometryShape.d.ts.map +1 -1
  34. package/dist/components/GeometryShape.js +0 -4
  35. package/dist/components/Glyphs.d.ts.map +1 -1
  36. package/dist/components/Glyphs.js +0 -1
  37. package/dist/components/GridsGenerator.d.ts +4 -1
  38. package/dist/components/GridsGenerator.d.ts.map +1 -1
  39. package/dist/components/GridsGenerator.js +28 -4
  40. package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
  41. package/dist/components/HdrPlaylistRenderer.js +0 -1
  42. package/dist/components/HexGrid.d.ts +25 -0
  43. package/dist/components/HexGrid.d.ts.map +1 -0
  44. package/dist/components/HexGrid.js +72 -0
  45. package/dist/components/ImageGeometry.js +1 -1
  46. package/dist/components/Letter.d.ts.map +1 -1
  47. package/dist/components/Letter.js +1 -6
  48. package/dist/components/MoireGrid.d.ts +23 -0
  49. package/dist/components/MoireGrid.d.ts.map +1 -0
  50. package/dist/components/MoireGrid.js +76 -0
  51. package/dist/components/Moon.d.ts.map +1 -1
  52. package/dist/components/Moon.js +0 -1
  53. package/dist/components/ObjectNode.d.ts +1 -2
  54. package/dist/components/ObjectNode.d.ts.map +1 -1
  55. package/dist/components/ObjectNode.js +17 -20
  56. package/dist/components/ObjectNodeApi.d.ts +1 -2
  57. package/dist/components/ObjectNodeApi.d.ts.map +1 -1
  58. package/dist/components/ObjectNodeApi.js +7 -3
  59. package/dist/components/ObjectsRenderer.d.ts.map +1 -1
  60. package/dist/components/ObjectsRenderer.js +1 -4
  61. package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
  62. package/dist/components/ObjectsRendererApi.js +4 -2
  63. package/dist/components/Ocean.d.ts.map +1 -1
  64. package/dist/components/Ocean.js +1 -4
  65. package/dist/components/ParticlesR3f.d.ts +0 -1
  66. package/dist/components/ParticlesR3f.d.ts.map +1 -1
  67. package/dist/components/PathRenderer.d.ts.map +1 -1
  68. package/dist/components/PathRenderer.js +0 -1
  69. package/dist/components/ProjectLoader.d.ts.map +1 -1
  70. package/dist/components/ProjectLoader.js +0 -28
  71. package/dist/components/QuasiGrid.d.ts +22 -0
  72. package/dist/components/QuasiGrid.d.ts.map +1 -0
  73. package/dist/components/QuasiGrid.js +68 -0
  74. package/dist/components/RadarGrid.d.ts +24 -0
  75. package/dist/components/RadarGrid.d.ts.map +1 -0
  76. package/dist/components/RadarGrid.js +71 -0
  77. package/dist/components/SceneBuilder.d.ts.map +1 -1
  78. package/dist/components/SceneBuilder.js +0 -1
  79. package/dist/components/ShootingStar.js +2 -2
  80. package/dist/components/ShootingStars.d.ts.map +1 -1
  81. package/dist/components/ShootingStars.js +0 -1
  82. package/dist/components/SkyController.d.ts.map +1 -1
  83. package/dist/components/SkyController.js +0 -3
  84. package/dist/components/Skybox.d.ts +5 -0
  85. package/dist/components/Skybox.d.ts.map +1 -1
  86. package/dist/components/Skybox.js +0 -1
  87. package/dist/components/SparklesBurst.d.ts.map +1 -1
  88. package/dist/components/SparklesBurst.js +0 -1
  89. package/dist/components/VoronoiGrid.d.ts +21 -0
  90. package/dist/components/VoronoiGrid.d.ts.map +1 -0
  91. package/dist/components/VoronoiGrid.js +67 -0
  92. package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
  93. package/dist/components/effects/ShockwaveEffect.js +0 -1
  94. package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
  95. package/dist/components/effects/SmokeRibbon.js +0 -1
  96. package/dist/components/index.d.ts +19 -2
  97. package/dist/components/index.d.ts.map +1 -1
  98. package/dist/components/index.js +9 -1
  99. package/dist/constants.d.ts +1 -1
  100. package/dist/constants.d.ts.map +1 -1
  101. package/dist/constants.js +2 -1
  102. package/dist/hooks/index.d.ts +4 -1
  103. package/dist/hooks/index.d.ts.map +1 -1
  104. package/dist/hooks/index.js +3 -1
  105. package/dist/hooks/use3driseShader.d.ts.map +1 -1
  106. package/dist/hooks/use3driseShader.js +0 -9
  107. package/dist/hooks/useAnimationEvents.d.ts.map +1 -1
  108. package/dist/hooks/useAnimationEvents.js +0 -19
  109. package/dist/hooks/useCameraAnimation.d.ts.map +1 -1
  110. package/dist/hooks/useCameraAnimation.js +0 -5
  111. package/dist/hooks/useContinuousEffects.d.ts +2 -3
  112. package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
  113. package/dist/hooks/useContinuousEffects.js +16 -61
  114. package/dist/hooks/useFrameAnimations.d.ts.map +1 -1
  115. package/dist/hooks/useFrameAnimations.js +0 -4
  116. package/dist/hooks/useGridSurface.d.ts +46 -0
  117. package/dist/hooks/useGridSurface.d.ts.map +1 -0
  118. package/dist/hooks/useGridSurface.js +66 -0
  119. package/dist/hooks/useGsapAnimation.d.ts.map +1 -1
  120. package/dist/hooks/useGsapAnimation.js +0 -3
  121. package/dist/hooks/useInteraction.d.ts.map +1 -1
  122. package/dist/hooks/useInteraction.js +0 -25
  123. package/dist/hooks/useInteractionEffects.d.ts +2 -2
  124. package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
  125. package/dist/hooks/useInteractionEffects.js +3 -1
  126. package/dist/hooks/useMaterialApplication.d.ts +2 -2
  127. package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
  128. package/dist/hooks/useMaterialApplication.js +7 -18
  129. package/dist/hooks/useMaterialOptions.d.ts.map +1 -1
  130. package/dist/hooks/useMaterialOptions.js +0 -6
  131. package/dist/hooks/useMeshController.d.ts.map +1 -1
  132. package/dist/hooks/useMeshController.js +0 -16
  133. package/dist/hooks/useObjectAnimation.d.ts +13 -2
  134. package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
  135. package/dist/hooks/useObjectAnimation.js +26 -28
  136. package/dist/hooks/useObjectEdges.d.ts +2 -1
  137. package/dist/hooks/useObjectEdges.d.ts.map +1 -1
  138. package/dist/hooks/useObjectEdges.js +15 -3
  139. package/dist/hooks/useObjectEffects.d.ts.map +1 -1
  140. package/dist/hooks/useObjectEffects.js +0 -4
  141. package/dist/hooks/useRegisterScene.d.ts +17 -0
  142. package/dist/hooks/useRegisterScene.d.ts.map +1 -0
  143. package/dist/hooks/useRegisterScene.js +33 -0
  144. package/dist/hooks/useSequenceAnimation.d.ts +2 -2
  145. package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
  146. package/dist/hooks/useSequenceAnimation.js +5 -70
  147. package/dist/hooks/useShadowApplication.d.ts +2 -2
  148. package/dist/hooks/useShadowApplication.d.ts.map +1 -1
  149. package/dist/hooks/useShadowApplication.js +6 -2
  150. package/dist/hooks/useSkyAnimation.d.ts.map +1 -1
  151. package/dist/hooks/useSkyAnimation.js +0 -1
  152. package/dist/hooks/useSkySystem.d.ts.map +1 -1
  153. package/dist/hooks/useSkySystem.js +0 -1
  154. package/dist/index.d.ts +3 -1
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +2 -1
  157. package/dist/services/AnimationsManager.d.ts.map +1 -1
  158. package/dist/services/AnimationsManager.js +0 -1
  159. package/dist/shaders/CircuitGridMaterial.d.ts +76 -0
  160. package/dist/shaders/CircuitGridMaterial.d.ts.map +1 -0
  161. package/dist/shaders/CircuitGridMaterial.js +298 -0
  162. package/dist/shaders/ContourGridMaterial.d.ts +80 -0
  163. package/dist/shaders/ContourGridMaterial.d.ts.map +1 -0
  164. package/dist/shaders/ContourGridMaterial.js +259 -0
  165. package/dist/shaders/FractalGridMaterial.d.ts +76 -0
  166. package/dist/shaders/FractalGridMaterial.d.ts.map +1 -0
  167. package/dist/shaders/FractalGridMaterial.js +247 -0
  168. package/dist/shaders/HexGridMaterial.d.ts +73 -0
  169. package/dist/shaders/HexGridMaterial.d.ts.map +1 -0
  170. package/dist/shaders/HexGridMaterial.js +265 -0
  171. package/dist/shaders/MoireGridMaterial.d.ts +79 -0
  172. package/dist/shaders/MoireGridMaterial.d.ts.map +1 -0
  173. package/dist/shaders/MoireGridMaterial.js +271 -0
  174. package/dist/shaders/QuasiGridMaterial.d.ts +76 -0
  175. package/dist/shaders/QuasiGridMaterial.d.ts.map +1 -0
  176. package/dist/shaders/QuasiGridMaterial.js +238 -0
  177. package/dist/shaders/RadarGridMaterial.d.ts +77 -0
  178. package/dist/shaders/RadarGridMaterial.d.ts.map +1 -0
  179. package/dist/shaders/RadarGridMaterial.js +291 -0
  180. package/dist/shaders/VoronoiGridMaterial.d.ts +73 -0
  181. package/dist/shaders/VoronoiGridMaterial.d.ts.map +1 -0
  182. package/dist/shaders/VoronoiGridMaterial.js +266 -0
  183. package/dist/types/gridConfigs.d.ts +202 -0
  184. package/dist/types/gridConfigs.d.ts.map +1 -0
  185. package/dist/types/gridConfigs.js +11 -0
  186. package/dist/types/index.d.ts +1 -0
  187. package/dist/types/index.d.ts.map +1 -1
  188. package/dist/utils/handleGenerativeEffectsAnimations.d.ts +0 -1
  189. package/dist/utils/handleGenerativeEffectsAnimations.d.ts.map +1 -1
  190. package/dist/utils/handleGenerativeEffectsAnimations.js +0 -29
  191. package/dist/utils/resolveObject3D.d.ts +20 -0
  192. package/dist/utils/resolveObject3D.d.ts.map +1 -0
  193. package/dist/utils/resolveObject3D.js +9 -0
  194. package/dist/utils/shapes.d.ts.map +1 -1
  195. package/dist/utils/shapes.js +0 -1
  196. package/package.json +4 -4
@@ -0,0 +1,73 @@
1
+ import * as THREE from 'three';
2
+ export interface VoronoiGridMaterialUniforms {
3
+ u_time: number;
4
+ /** average cell width, in world units */
5
+ u_cellSize: number;
6
+ /** cell-edge thickness, in pixels */
7
+ u_lineWidth: number;
8
+ /** how many cells make one accent group */
9
+ u_sectionSize: number;
10
+ /** nucleus size; 0 hides the nuclei */
11
+ u_sectionWidth: number;
12
+ u_lineColor: THREE.Color;
13
+ u_sectionColor: THREE.Color;
14
+ u_cellColor: THREE.Color;
15
+ u_glowColor: THREE.Color;
16
+ u_bgColor: THREE.Color;
17
+ u_bgOpacity: number;
18
+ u_lineMode: number;
19
+ u_cellMode: number;
20
+ u_animSpeed: number;
21
+ u_animScale: number;
22
+ u_animIntensity: number;
23
+ u_fadeDistance: number;
24
+ u_fadeStrength: number;
25
+ u_focus: THREE.Vector2;
26
+ u_mouse: THREE.Vector2;
27
+ u_displace: number;
28
+ /**
29
+ * 0..1 assemble/dissolve. The build boundary sweeps outward from u_focus
30
+ * with a bright leading edge; 1 is fully built, 0 is gone. Animate it
31
+ * downward to dissolve.
32
+ */
33
+ u_reveal: number;
34
+ /** 0 = regular square lattice, 1 = fully scattered seeds */
35
+ u_jitter: number;
36
+ /** how far the seeds wander over time; 0 freezes the lattice */
37
+ u_drift: number;
38
+ }
39
+ declare module '@react-three/fiber' {
40
+ interface ThreeElements {
41
+ voronoiGridMaterial: ThreeElements['shaderMaterial'] & Partial<VoronoiGridMaterialUniforms>;
42
+ }
43
+ }
44
+ export declare const voronoiGridMaterialDefaults: VoronoiGridMaterialUniforms;
45
+ export declare const VoronoiGridMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
46
+ u_time: number;
47
+ u_cellSize: number;
48
+ u_lineWidth: number;
49
+ u_sectionSize: number;
50
+ u_sectionWidth: number;
51
+ u_lineColor: THREE.Color;
52
+ u_sectionColor: THREE.Color;
53
+ u_cellColor: THREE.Color;
54
+ u_glowColor: THREE.Color;
55
+ u_bgColor: THREE.Color;
56
+ u_bgOpacity: number;
57
+ u_lineMode: number;
58
+ u_cellMode: number;
59
+ u_animSpeed: number;
60
+ u_animScale: number;
61
+ u_animIntensity: number;
62
+ u_fadeDistance: number;
63
+ u_fadeStrength: number;
64
+ u_focus: THREE.Vector2;
65
+ u_mouse: THREE.Vector2;
66
+ u_displace: number;
67
+ u_reveal: number;
68
+ u_jitter: number;
69
+ u_drift: number;
70
+ }> & {
71
+ key: string;
72
+ };
73
+ //# sourceMappingURL=VoronoiGridMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VoronoiGridMaterial.d.ts","sourceRoot":"","sources":["../../src/shaders/VoronoiGridMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAChC,UAAU,aAAa;QACnB,mBAAmB,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAC/F;CACJ;AAED,eAAO,MAAM,2BAA2B,EAAE,2BAyBzC,CAAC;AAuNF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B/B,CAAC"}
@@ -0,0 +1,266 @@
1
+ import * as THREE from 'three';
2
+ import { shaderMaterial } from '@react-three/drei';
3
+ import { extend } from '@react-three/fiber';
4
+ export const voronoiGridMaterialDefaults = {
5
+ u_time: 0,
6
+ u_cellSize: 2.0,
7
+ u_lineWidth: 1.4,
8
+ u_sectionSize: 4.0,
9
+ u_sectionWidth: 1.0,
10
+ u_lineColor: new THREE.Color(0.35, 0.2, 0.62),
11
+ u_sectionColor: new THREE.Color(0.85, 0.6, 1.0),
12
+ u_cellColor: new THREE.Color(0.12, 0.05, 0.28),
13
+ u_glowColor: new THREE.Color(0.7, 0.4, 1.0),
14
+ u_bgColor: new THREE.Color(0.02, 0.01, 0.05),
15
+ u_bgOpacity: 0.0,
16
+ u_lineMode: 1,
17
+ u_cellMode: 2,
18
+ u_animSpeed: 1.0,
19
+ u_animScale: 0.5,
20
+ u_animIntensity: 1.0,
21
+ u_fadeDistance: 25.0,
22
+ u_fadeStrength: 0.7,
23
+ u_focus: new THREE.Vector2(0, 0),
24
+ u_mouse: new THREE.Vector2(0, 0),
25
+ u_displace: 0.0,
26
+ u_reveal: 1.0,
27
+ u_jitter: 0.9,
28
+ u_drift: 0.5,
29
+ };
30
+ /**
31
+ * Shared by both stages.
32
+ *
33
+ * One 3x3 pass yields both the nearest seed distance (F1) and the runner-up
34
+ * (F2). `F2 - F1` goes to zero exactly on a cell boundary, which is the edge
35
+ * field — cheaper than a second pass and stable under animation, since it never
36
+ * has to decide which of two equidistant seeds "won".
37
+ */
38
+ const voronoiCommon = /*glsl*/ `
39
+ const float TAU = 6.28318530718;
40
+
41
+ vec2 hash22(vec2 p){
42
+ p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));
43
+ return fract(sin(p) * 43758.5453123);
44
+ }
45
+
46
+ /** x = F1, y = F2, zw = the winning cell's id */
47
+ vec4 voronoi(vec2 x, float jitter, float drift, float t){
48
+ vec2 n = floor(x);
49
+ vec2 f = x - n;
50
+ float f1 = 8.0;
51
+ float f2 = 8.0;
52
+ vec2 winner = n;
53
+
54
+ for (int j = -1; j <= 1; j++){
55
+ for (int i = -1; i <= 1; i++){
56
+ vec2 g = vec2(float(i), float(j));
57
+ vec2 h = hash22(n + g);
58
+ vec2 off = (h - 0.5) * clamp(jitter, 0.0, 1.0);
59
+ if (drift > 0.0){
60
+ off += drift * 0.22 * vec2(
61
+ sin(t * (0.4 + h.x * 0.8) + h.y * TAU),
62
+ cos(t * (0.4 + h.y * 0.8) + h.x * TAU)
63
+ );
64
+ }
65
+ // Keeping every seed inside its own cell is what makes the 3x3
66
+ // neighbourhood sufficient — without the clamp, jitter plus drift can
67
+ // push a seed far enough out that the true nearest one is never tested.
68
+ vec2 o = vec2(0.5) + clamp(off, vec2(-0.49), vec2(0.49));
69
+ vec2 r = g + o - f;
70
+ float d = dot(r, r);
71
+ if (d < f1){ f2 = f1; f1 = d; winner = n + g; }
72
+ else if (d < f2){ f2 = d; }
73
+ }
74
+ }
75
+ return vec4(sqrt(f1), sqrt(f2), winner);
76
+ }
77
+ `;
78
+ const vertex = /*glsl*/ `
79
+ uniform float u_time;
80
+ uniform float u_cellSize;
81
+ uniform float u_displace;
82
+ uniform float u_animSpeed;
83
+ uniform float u_animScale;
84
+ uniform float u_jitter;
85
+ uniform float u_drift;
86
+
87
+ varying vec2 vGridPos;
88
+
89
+ ${voronoiCommon}
90
+
91
+ void main(){
92
+ vGridPos = position.xy;
93
+ vec3 pos = position;
94
+ if (u_displace > 0.0){
95
+ float t = u_time * u_animSpeed;
96
+ vec2 coord = position.xy / max(u_cellSize, 1e-4);
97
+ vec4 v = voronoi(coord, u_jitter, u_drift, t);
98
+ vec2 h = hash22(v.zw);
99
+ // One height per cell, so the surface breaks into irregular plates. The
100
+ // height rides a smooth field with only a hashed nudge per cell —
101
+ // uncorrelated neighbours would shred the mesh — and the plate ramps back
102
+ // to that field near the membrane, so the walls bevel instead of
103
+ // sawtoothing across whatever triangles straddle the boundary.
104
+ float smoothLift = 0.5 + 0.5 * sin(length(coord) * u_animScale - t);
105
+ float plate = clamp(smoothLift + (h.x - 0.5) * 0.5, 0.0, 1.0);
106
+ float flatness = smoothstep(0.0, 0.3, v.y - v.x);
107
+ pos.z += mix(smoothLift, plate, flatness) * u_displace;
108
+ }
109
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
110
+ }
111
+ `;
112
+ const fragment = /*glsl*/ `
113
+ precision highp float;
114
+
115
+ uniform float u_time;
116
+ uniform float u_cellSize;
117
+ uniform float u_lineWidth;
118
+ uniform float u_sectionSize;
119
+ uniform float u_sectionWidth;
120
+ uniform vec3 u_lineColor;
121
+ uniform vec3 u_sectionColor;
122
+ uniform vec3 u_cellColor;
123
+ uniform vec3 u_glowColor;
124
+ uniform vec3 u_bgColor;
125
+ uniform float u_bgOpacity;
126
+ uniform float u_lineMode;
127
+ uniform float u_cellMode;
128
+ uniform float u_animSpeed;
129
+ uniform float u_animScale;
130
+ uniform float u_animIntensity;
131
+ uniform float u_fadeDistance;
132
+ uniform float u_fadeStrength;
133
+ uniform vec2 u_focus;
134
+ uniform float u_reveal;
135
+ uniform float u_jitter;
136
+ uniform float u_drift;
137
+
138
+ varying vec2 vGridPos;
139
+
140
+ ${voronoiCommon}
141
+
142
+ void main(){
143
+ vec2 coord = vGridPos / max(u_cellSize, 1e-4);
144
+ vec2 focus = u_focus / max(u_cellSize, 1e-4);
145
+ float t = u_time * u_animSpeed;
146
+ float px = max(length(fwidth(coord)), 1e-6);
147
+
148
+ vec4 v = voronoi(coord, u_jitter, u_drift, t);
149
+ float f1 = v.x;
150
+ float f2 = v.y;
151
+ vec2 id = v.zw;
152
+ vec2 h = hash22(id);
153
+
154
+ // membrane between cells
155
+ float edge = 1.0 - smoothstep(0.0, px * max(u_lineWidth, 0.05) * 2.0, f2 - f1);
156
+
157
+ // accent membranes: whole clusters of cells share one group id
158
+ float group = 0.0;
159
+ if (u_sectionSize > 0.0){
160
+ vec2 gid = floor(id / u_sectionSize);
161
+ group = step(0.5, hash22(gid).x);
162
+ }
163
+
164
+ // ---- membrane animation ---------------------------------------------
165
+ float lineAnim = 1.0;
166
+ if (u_lineMode > 0.5 && u_lineMode < 1.5){
167
+ lineAnim = 0.5 + 0.5 * sin(length(id + 0.5 - focus) * u_animScale - t);
168
+ } else if (u_lineMode < 2.5){
169
+ // charge running along the membranes
170
+ lineAnim = 0.35 + 0.65 * pow(fract(dot(coord, vec2(0.35, 0.2)) * u_animScale - t * 0.25), 6.0);
171
+ } else if (u_lineMode < 3.5){
172
+ float s = fract((coord.x + coord.y) * 0.05 * u_animScale - t * 0.15);
173
+ lineAnim = 0.25 + smoothstep(0.0, 0.15, s) * (1.0 - smoothstep(0.15, 0.35, s));
174
+ } else if (u_lineMode < 4.5){
175
+ lineAnim = 0.5 + 0.5 * sin(t);
176
+ }
177
+ lineAnim = mix(1.0, lineAnim, u_animIntensity);
178
+
179
+ // ---- cell fill ------------------------------------------------------
180
+ float cell = 0.0;
181
+ if (u_cellMode > 0.5 && u_cellMode < 1.5){
182
+ cell = 0.5 + 0.5 * sin(dot(id, vec2(0.7, 0.3)) * u_animScale - t);
183
+ } else if (u_cellMode < 2.5){
184
+ cell = 0.5 + 0.5 * sin(t * (0.6 + h.x) + h.y * TAU);
185
+ } else if (u_cellMode < 3.5){
186
+ // cells fire in rings out from the focus, like a signal propagating
187
+ cell = smoothstep(0.6, 1.0, sin(length(id + 0.5 - focus) * u_animScale - t));
188
+ } else if (u_cellMode < 4.5){
189
+ cell = step(0.5, h.x) * (0.5 + 0.5 * sin(t));
190
+ }
191
+ cell *= u_animIntensity;
192
+ // brighten the fill toward the nucleus, so each cell reads as a volume
193
+ // rather than a flat patch
194
+ cell *= mix(0.45, 1.0, 1.0 - smoothstep(0.0, 0.7, f1));
195
+
196
+ // ---- nuclei ---------------------------------------------------------
197
+ float nucleus = 0.0;
198
+ if (u_sectionWidth > 0.0){
199
+ float nr = 0.05 * u_sectionWidth;
200
+ nucleus = 1.0 - smoothstep(nr, nr + px * 2.0, f1);
201
+ }
202
+
203
+ float r = length(vGridPos) / max(u_fadeDistance, 1e-4);
204
+ float fade = 1.0 - smoothstep(1.0 - u_fadeStrength, 1.0, r);
205
+
206
+ vec3 col = u_bgColor * u_bgOpacity;
207
+ float a = u_bgOpacity;
208
+
209
+ col += u_cellColor * cell; a = max(a, cell * 0.9);
210
+ float edgeI = edge * lineAnim;
211
+ col += mix(u_lineColor, u_sectionColor, group) * edgeI;
212
+ a = max(a, edgeI);
213
+ float nucI = nucleus * (0.4 + 0.6 * cell + 0.4 * lineAnim);
214
+ col += u_sectionColor * nucI; a = max(a, nucI);
215
+ col += u_glowColor * (edgeI * 0.25 + nucI * 0.8 + cell * 0.2) * u_animIntensity;
216
+
217
+ col *= fade;
218
+ a *= fade;
219
+
220
+ // ---- reveal ----------------------------------------------------------
221
+ // The build boundary sweeps outward from the focus point. Its leading band
222
+ // mostly brightens whatever is already there rather than painting a solid
223
+ // disc, so the grid reads as assembling itself rather than fading in.
224
+ if (u_reveal < 0.999){
225
+ float rd = length(vGridPos - u_focus) / max(u_fadeDistance, 1e-4);
226
+ // 1.1, not 1.25: the boundary has to clear the fade radius by just the
227
+ // width of its own soft edge. Overshooting further finishes the build
228
+ // before reveal reaches 1 and leaves the tail of the range doing nothing.
229
+ float edge = u_reveal * 1.1;
230
+ float mask = 1.0 - smoothstep(edge - 0.05, edge, rd);
231
+ float front = mask * smoothstep(edge - 0.22, edge - 0.05, rd);
232
+ col = col * mask + u_glowColor * front * (a * 1.8 + 0.08);
233
+ a = max(a * mask, front * 0.10);
234
+ }
235
+
236
+ if (a < 0.002) discard;
237
+ gl_FragColor = vec4(col, a);
238
+ }
239
+ `;
240
+ export const VoronoiGridMaterial = shaderMaterial({
241
+ u_time: voronoiGridMaterialDefaults.u_time,
242
+ u_cellSize: voronoiGridMaterialDefaults.u_cellSize,
243
+ u_lineWidth: voronoiGridMaterialDefaults.u_lineWidth,
244
+ u_sectionSize: voronoiGridMaterialDefaults.u_sectionSize,
245
+ u_sectionWidth: voronoiGridMaterialDefaults.u_sectionWidth,
246
+ u_lineColor: voronoiGridMaterialDefaults.u_lineColor.clone(),
247
+ u_sectionColor: voronoiGridMaterialDefaults.u_sectionColor.clone(),
248
+ u_cellColor: voronoiGridMaterialDefaults.u_cellColor.clone(),
249
+ u_glowColor: voronoiGridMaterialDefaults.u_glowColor.clone(),
250
+ u_bgColor: voronoiGridMaterialDefaults.u_bgColor.clone(),
251
+ u_bgOpacity: voronoiGridMaterialDefaults.u_bgOpacity,
252
+ u_lineMode: voronoiGridMaterialDefaults.u_lineMode,
253
+ u_cellMode: voronoiGridMaterialDefaults.u_cellMode,
254
+ u_animSpeed: voronoiGridMaterialDefaults.u_animSpeed,
255
+ u_animScale: voronoiGridMaterialDefaults.u_animScale,
256
+ u_animIntensity: voronoiGridMaterialDefaults.u_animIntensity,
257
+ u_fadeDistance: voronoiGridMaterialDefaults.u_fadeDistance,
258
+ u_fadeStrength: voronoiGridMaterialDefaults.u_fadeStrength,
259
+ u_focus: voronoiGridMaterialDefaults.u_focus.clone(),
260
+ u_mouse: voronoiGridMaterialDefaults.u_mouse.clone(),
261
+ u_displace: voronoiGridMaterialDefaults.u_displace,
262
+ u_reveal: voronoiGridMaterialDefaults.u_reveal,
263
+ u_jitter: voronoiGridMaterialDefaults.u_jitter,
264
+ u_drift: voronoiGridMaterialDefaults.u_drift,
265
+ }, vertex, fragment);
266
+ extend({ VoronoiGridMaterial });
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Config shapes for the shader-plane grids that live in this package.
3
+ *
4
+ * `MyGridConfig` (the square `superGrid`) is owned by `@3driseai/3drise-core`.
5
+ * These four are declared locally, but they deliberately reuse its field names
6
+ * — `cellSize`, `lineMode`, `cellMode`, `lineWidth`, `sectionSize`,
7
+ * `sectionWidth`, `anim*`, `fade*`, `displace` and the colour set — so a
8
+ * controller panel built for `superGrid` drives all of them with the same
9
+ * knobs, and presets read the same way across grid types.
10
+ */
11
+ /** Animation mode for the line/edge layer. Same vocabulary in every grid. */
12
+ export type GridLineMode =
13
+ /** static */
14
+ 0
15
+ /** ripple outward from the focus point */
16
+ | 1
17
+ /** flow — a travelling wave across the surface */
18
+ | 2
19
+ /** scan — a bright band sweeping through */
20
+ | 3
21
+ /** pulse — the whole surface breathes together */
22
+ | 4;
23
+ /** Animation mode for the cell/fill layer. Same vocabulary in every grid. */
24
+ export type GridCellMode =
25
+ /** off */
26
+ 0
27
+ /** wave — cells light in a smooth gradient */
28
+ | 1
29
+ /** twinkle — each cell on its own hashed phase */
30
+ | 2
31
+ /** ripple — cells fire in rings out from the focus point */
32
+ | 3
33
+ /** alternate — a checker/parity pattern that breathes */
34
+ | 4;
35
+ /** Fields every shader-plane grid shares, whatever its tiling. */
36
+ export interface GridSurfaceConfig {
37
+ /** world size of the plane, per side */
38
+ size: number;
39
+ /** plane subdivisions per side; auto-derived when omitted, bumped when `displace > 0` */
40
+ segments?: number;
41
+ /** lay flat on XZ (true) or stand upright on XY (false) */
42
+ flat: boolean;
43
+ /** base size of one tile in world units */
44
+ cellSize: number;
45
+ lineMode: GridLineMode;
46
+ cellMode: GridCellMode;
47
+ /** line/edge thickness, in pixels */
48
+ lineWidth: number;
49
+ /** how many base tiles make one accent group */
50
+ sectionSize: number;
51
+ /** accent thickness, in pixels; 0 disables the accent layer */
52
+ sectionWidth: number;
53
+ animSpeed: number;
54
+ animScale: number;
55
+ animIntensity: number;
56
+ /** radius at which the grid fades out; defaults to half `size` */
57
+ fadeDistance?: number;
58
+ fadeStrength: number;
59
+ /** vertex displacement along the plane normal; needs a segmented plane */
60
+ displace: number;
61
+ lineColor: string;
62
+ sectionColor: string;
63
+ cellColor: string;
64
+ glowColor: string;
65
+ bgColor: string;
66
+ bgOpacity: number;
67
+ /** project the pointer onto the plane and feed it to the focus point */
68
+ followMouse: boolean;
69
+ /**
70
+ * 0..1 assemble amount. The build boundary sweeps outward from the focus
71
+ * point with a bright leading edge. Defaults to 1 (fully built); animate it
72
+ * down to 0 to dissolve.
73
+ */
74
+ reveal?: number;
75
+ /**
76
+ * Seconds to travel the full 0..1 reveal range. Defaults to 0, which
77
+ * applies `reveal` immediately — a grid does not animate itself in unless
78
+ * asked. Set ~1.2 for a build-in on mount.
79
+ */
80
+ revealDuration?: number;
81
+ }
82
+ /**
83
+ * Honeycomb tiling. `cellSize` is the hex's flat-to-flat width, `sectionSize`
84
+ * groups hexes into super-hexes drawn in `sectionColor`.
85
+ */
86
+ export interface HexGridConfig extends GridSurfaceConfig {
87
+ /**
88
+ * With `displace > 0`, each hex lifts to its own height instead of riding a
89
+ * smooth wave — a plated, tessellated-terrain look with vertical walls.
90
+ */
91
+ plateau: boolean;
92
+ }
93
+ /**
94
+ * Truchet circuit board. Each tile picks one of two arc rotations, so traces
95
+ * connect across tiles into long meandering paths.
96
+ */
97
+ export interface CircuitGridConfig extends GridSurfaceConfig {
98
+ /** 0..1 — fraction of tiles that carry a powered trace */
99
+ powered: number;
100
+ /** 0..1 — fraction of tiles replaced by an IC package. 0 disables chips */
101
+ chipChance: number;
102
+ /** solder-pad radius as a fraction of a tile; 0 disables pads */
103
+ padSize: number;
104
+ }
105
+ /**
106
+ * Voronoi lattice — irregular cells that drift and morph. `cellSize` is the
107
+ * average cell width; `sectionColor`/`sectionWidth` draw the cell nuclei.
108
+ */
109
+ export interface VoronoiGridConfig extends GridSurfaceConfig {
110
+ /** 0 = regular square lattice, 1 = fully scattered seeds */
111
+ jitter: number;
112
+ /** how far the seeds wander over time; 0 freezes the lattice */
113
+ drift: number;
114
+ }
115
+ /**
116
+ * Polar HUD. `cellSize` is the ring spacing, `sectionSize` marks every Nth ring
117
+ * as a major ring, and the surface is masked to a disc of `fadeDistance`.
118
+ */
119
+ export interface RadarGridConfig extends GridSurfaceConfig {
120
+ /** number of radial spokes; 0 disables them */
121
+ spokes: number;
122
+ /** angular length of the sweep trail, as a fraction of a full turn; 0 disables the sweep */
123
+ sweepWidth: number;
124
+ /** 0..1 — chance that any given ring/spoke sector holds a blip */
125
+ blipDensity: number;
126
+ }
127
+ /**
128
+ * Two overlaid lattices whose near-coincidence produces the interference
129
+ * pattern. `cellSize` is the base spacing; the second layer differs from the
130
+ * first by `layerAngle` and `layerScale`.
131
+ */
132
+ export interface MoireGridConfig extends GridSurfaceConfig {
133
+ /** lattice shape for both layers */
134
+ shape: 'square' | 'hex' | 'rings';
135
+ /** fixed angle between the two layers, in radians. Small values beat slowly */
136
+ layerAngle: number;
137
+ /** spacing ratio of the second layer; near 1 gives long, slow beats */
138
+ layerScale: number;
139
+ /** counter-rotation speed; 0 freezes the pattern at `layerAngle` */
140
+ spin: number;
141
+ }
142
+ /**
143
+ * A quadtree that subdivides toward the focus point, so the lattice is fine
144
+ * where you are pointing and coarse at the edges. `cellSize` is the level-0
145
+ * cell; each level halves it.
146
+ */
147
+ export interface FractalGridConfig extends GridSurfaceConfig {
148
+ /** maximum subdivision levels, 1..6 */
149
+ depth: number;
150
+ /** radius around the focus, in level-0 cells, inside which cells subdivide */
151
+ splitRadius: number;
152
+ /** 0..1 — how much the split radius wobbles per cell, for an organic edge */
153
+ splitJitter: number;
154
+ }
155
+ /**
156
+ * Topographic iso-lines over an animated terrain field. `cellSize` is the
157
+ * horizontal scale of the terrain; `sectionSize` marks index contours.
158
+ *
159
+ * `displace` is literal here rather than decorative: the vertex stage raises
160
+ * the surface to exactly the elevation the contours describe.
161
+ */
162
+ export interface ContourGridConfig extends GridSurfaceConfig {
163
+ /** number of contour steps across the full height range */
164
+ levels: number;
165
+ /** fbm gain — 0.35 rolling, 0.65 craggy */
166
+ roughness: number;
167
+ /** domain warp; bends the contours into ridges and valleys */
168
+ warp: number;
169
+ }
170
+ /**
171
+ * An aperiodic de Bruijn multigrid — Penrose at the default 5-fold symmetry.
172
+ * The intersections never repeat, so the pattern never tiles back on itself
173
+ * however far the camera travels.
174
+ */
175
+ export interface QuasiGridConfig extends GridSurfaceConfig {
176
+ /**
177
+ * How many line families, 3..9. 5 is Penrose. 4 and 6 divide the half-turn
178
+ * evenly and so come out periodic; everything else is quasiperiodic.
179
+ */
180
+ symmetry: number;
181
+ /** shifts every family's offset together, sliding the pattern through itself */
182
+ phase: number;
183
+ }
184
+ /** Every grid config this package can render, tagged by `type`. */
185
+ export type AnyGridConfig = (HexGridConfig & {
186
+ type: 'hexGrid';
187
+ }) | (CircuitGridConfig & {
188
+ type: 'circuitGrid';
189
+ }) | (VoronoiGridConfig & {
190
+ type: 'voronoiGrid';
191
+ }) | (RadarGridConfig & {
192
+ type: 'radarGrid';
193
+ }) | (MoireGridConfig & {
194
+ type: 'moireGrid';
195
+ }) | (FractalGridConfig & {
196
+ type: 'fractalGrid';
197
+ }) | (ContourGridConfig & {
198
+ type: 'contourGrid';
199
+ }) | (QuasiGridConfig & {
200
+ type: 'quasiGrid';
201
+ });
202
+ //# sourceMappingURL=gridConfigs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gridConfigs.d.ts","sourceRoot":"","sources":["../../src/types/gridConfigs.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Config shapes for the shader-plane grids that live in this package.
3
+ *
4
+ * `MyGridConfig` (the square `superGrid`) is owned by `@3driseai/3drise-core`.
5
+ * These four are declared locally, but they deliberately reuse its field names
6
+ * — `cellSize`, `lineMode`, `cellMode`, `lineWidth`, `sectionSize`,
7
+ * `sectionWidth`, `anim*`, `fade*`, `displace` and the colour set — so a
8
+ * controller panel built for `superGrid` drives all of them with the same
9
+ * knobs, and presets read the same way across grid types.
10
+ */
11
+ export {};
@@ -1,2 +1,3 @@
1
1
  export type { ObjectReadyProps, ObjectReadySource, OnObjectDispose, OnObjectReady, } from './objectReady';
2
+ export type { AnyGridConfig, CircuitGridConfig, ContourGridConfig, FractalGridConfig, GridCellMode, GridLineMode, GridSurfaceConfig, HexGridConfig, MoireGridConfig, QuasiGridConfig, RadarGridConfig, VoronoiGridConfig, } from './gridConfigs';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import * as THREE from 'three';
2
2
  import type { AnimationOptions } from "@3driseai/3drise-core";
3
- export declare const DEBUG_GENERATIVE_EFFECTS = false;
4
3
  export declare function applyGenerativeAnimations(materials: THREE.ShaderMaterial[], animations: AnimationOptions[] | undefined, startValuesCache: Record<string, any>, currentTime: number, hovered: boolean): void;
5
4
  //# sourceMappingURL=handleGenerativeEffectsAnimations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleGenerativeEffectsAnimations.d.ts","sourceRoot":"","sources":["../../src/utils/handleGenerativeEffectsAnimations.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAuG9D,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAkF9C,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CA+D3M"}
1
+ {"version":3,"file":"handleGenerativeEffectsAnimations.d.ts","sourceRoot":"","sources":["../../src/utils/handleGenerativeEffectsAnimations.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAuK9D,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAoD3M"}
@@ -120,24 +120,6 @@ const applyEasing = (easingName, progress) => {
120
120
  // =============================================================================
121
121
  // DEBUG
122
122
  // =============================================================================
123
- export const DEBUG_GENERATIVE_EFFECTS = false;
124
- const log = (message, ...args) => {
125
- if (DEBUG_GENERATIVE_EFFECTS)
126
- console.log(`[GenerativeEffectsAnimations] ${message}`, ...args);
127
- };
128
- const _loggedOnce = new Set();
129
- const logOnce = (key, message, ...args) => {
130
- if (_loggedOnce.has(key))
131
- return;
132
- _loggedOnce.add(key);
133
- console.log(`[GenerativeEffectsAnimations] ${message}`, ...args);
134
- };
135
- const warnOnce = (key, message, ...args) => {
136
- if (_loggedOnce.has(key))
137
- return;
138
- _loggedOnce.add(key);
139
- console.warn(`[GenerativeEffectsAnimations] ${message}`, ...args);
140
- };
141
123
  // =============================================================================
142
124
  // HELPERS
143
125
  // =============================================================================
@@ -207,31 +189,25 @@ export function applyGenerativeAnimations(materials, animations, startValuesCach
207
189
  return;
208
190
  if (materials.length === 0)
209
191
  return;
210
- logOnce('called', `Processing ${animations.length} animation(s) across ${materials.length} material(s)`);
211
192
  for (const animation of animations) {
212
193
  try {
213
194
  const { property, to, duration, ease, loop = false, yoyo = false, active, triggerMode = 'always', } = animation;
214
195
  if (active === false) {
215
- log(`Skipping "${property}": active=false`);
216
196
  continue;
217
197
  }
218
198
  if (triggerMode === 'hover' && !hovered) {
219
- log(`Skipping "${property}": triggerMode=hover but not hovered`);
220
199
  continue;
221
200
  }
222
201
  if (to === undefined) {
223
- warnOnce(`no-to-${property}`, `Skipping "${property}": no 'to' value defined`);
224
202
  continue;
225
203
  }
226
204
  const uniformName = findUniformName(materials, property);
227
205
  if (!uniformName) {
228
- warnOnce(`no-uniform-${property}`, `No uniform found for property "${property}" (tried: ${candidateUniformNames(property).join(', ')}) — available uniforms on mat[0]: ${Object.keys(materials[0]?.uniforms ?? {}).join(', ')}`);
229
206
  continue;
230
207
  }
231
208
  if (!(property in startValuesCache)) {
232
209
  const currentVal = readUniformValue(materials, uniformName);
233
210
  startValuesCache[property] = animation.from !== undefined ? animation.from : currentVal;
234
- log('cached start value', { property, uniformName, startValue: startValuesCache[property] });
235
211
  }
236
212
  const from = startValuesCache[property];
237
213
  if (from === undefined || from === null)
@@ -243,26 +219,21 @@ export function applyGenerativeAnimations(materials, animations, startValuesCach
243
219
  }
244
220
  if (isColorValue(from)) {
245
221
  if (typeof to !== 'string') {
246
- warnOnce(`bad-to-${property}`, `Color property "${property}" has non-string 'to' value:`, to);
247
222
  continue;
248
223
  }
249
224
  applyColorToMaterials(materials, uniformName, from, to, timeProgress);
250
225
  }
251
226
  else if (typeof from === 'number') {
252
227
  if (typeof to !== 'number') {
253
- warnOnce(`bad-to-num-${property}`, `Numeric property "${property}" has non-numeric 'to' value:`, to);
254
228
  continue;
255
229
  }
256
230
  applyNumericToMaterials(materials, uniformName, MathUtils.lerp(from, to, timeProgress));
257
231
  }
258
232
  else {
259
- warnOnce(`bad-from-${property}`, `Unhandled 'from' type for property "${property}":`, typeof from, from);
260
233
  continue;
261
234
  }
262
- log('animated', { property, uniformName, from, to, timeProgress });
263
235
  }
264
236
  catch (err) {
265
- console.error(`[GenerativeEffectsAnimations] Error animating property "${animation.property}":`, err);
266
237
  }
267
238
  }
268
239
  }