@ntalmagor/3drize-viewer 0.1.2

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 (337) hide show
  1. package/dist/components/AnimatedObject.d.ts +22 -0
  2. package/dist/components/AnimatedObject.d.ts.map +1 -0
  3. package/dist/components/AnimatedObject.js +121 -0
  4. package/dist/components/CameraController.d.ts +16 -0
  5. package/dist/components/CameraController.d.ts.map +1 -0
  6. package/dist/components/CameraController.js +132 -0
  7. package/dist/components/Clouds.d.ts +14 -0
  8. package/dist/components/Clouds.d.ts.map +1 -0
  9. package/dist/components/Clouds.js +97 -0
  10. package/dist/components/CreatedObject.d.ts +12 -0
  11. package/dist/components/CreatedObject.d.ts.map +1 -0
  12. package/dist/components/CreatedObject.js +139 -0
  13. package/dist/components/CustomPrimitive.d.ts +12 -0
  14. package/dist/components/CustomPrimitive.d.ts.map +1 -0
  15. package/dist/components/CustomPrimitive.js +80 -0
  16. package/dist/components/EffectsGenerator.d.ts +10 -0
  17. package/dist/components/EffectsGenerator.d.ts.map +1 -0
  18. package/dist/components/EffectsGenerator.js +59 -0
  19. package/dist/components/EffectsGroup.d.ts +8 -0
  20. package/dist/components/EffectsGroup.d.ts.map +1 -0
  21. package/dist/components/EffectsGroup.js +8 -0
  22. package/dist/components/EnvironmentManager.d.ts +9 -0
  23. package/dist/components/EnvironmentManager.d.ts.map +1 -0
  24. package/dist/components/EnvironmentManager.js +47 -0
  25. package/dist/components/Frame.d.ts +26 -0
  26. package/dist/components/Frame.d.ts.map +1 -0
  27. package/dist/components/Frame.js +50 -0
  28. package/dist/components/FrameGeometry.d.ts +10 -0
  29. package/dist/components/FrameGeometry.d.ts.map +1 -0
  30. package/dist/components/FrameGeometry.js +17 -0
  31. package/dist/components/FrameImage.d.ts +14 -0
  32. package/dist/components/FrameImage.d.ts.map +1 -0
  33. package/dist/components/FrameImage.js +15 -0
  34. package/dist/components/Galaxy.d.ts +8 -0
  35. package/dist/components/Galaxy.d.ts.map +1 -0
  36. package/dist/components/Galaxy.js +9 -0
  37. package/dist/components/GalleryLayout.d.ts +10 -0
  38. package/dist/components/GalleryLayout.d.ts.map +1 -0
  39. package/dist/components/GalleryLayout.js +18 -0
  40. package/dist/components/GridHelper.d.ts +23 -0
  41. package/dist/components/GridHelper.d.ts.map +1 -0
  42. package/dist/components/GridHelper.js +38 -0
  43. package/dist/components/ImageGeometry.d.ts +14 -0
  44. package/dist/components/ImageGeometry.d.ts.map +1 -0
  45. package/dist/components/ImageGeometry.js +62 -0
  46. package/dist/components/Lensflare.d.ts +12 -0
  47. package/dist/components/Lensflare.d.ts.map +1 -0
  48. package/dist/components/Lensflare.js +66 -0
  49. package/dist/components/Letter.d.ts +20 -0
  50. package/dist/components/Letter.d.ts.map +1 -0
  51. package/dist/components/Letter.js +83 -0
  52. package/dist/components/Letters.d.ts +16 -0
  53. package/dist/components/Letters.d.ts.map +1 -0
  54. package/dist/components/Letters.js +18 -0
  55. package/dist/components/LightsManager.d.ts +9 -0
  56. package/dist/components/LightsManager.d.ts.map +1 -0
  57. package/dist/components/LightsManager.js +121 -0
  58. package/dist/components/Lines.d.ts +9 -0
  59. package/dist/components/Lines.d.ts.map +1 -0
  60. package/dist/components/Lines.js +19 -0
  61. package/dist/components/LoadingIndicator.d.ts +10 -0
  62. package/dist/components/LoadingIndicator.d.ts.map +1 -0
  63. package/dist/components/LoadingIndicator.js +143 -0
  64. package/dist/components/MaterialLibrary.d.ts +9 -0
  65. package/dist/components/MaterialLibrary.d.ts.map +1 -0
  66. package/dist/components/MaterialLibrary.js +57 -0
  67. package/dist/components/Moon.d.ts +13 -0
  68. package/dist/components/Moon.d.ts.map +1 -0
  69. package/dist/components/Moon.js +52 -0
  70. package/dist/components/ObjectNode.d.ts +11 -0
  71. package/dist/components/ObjectNode.d.ts.map +1 -0
  72. package/dist/components/ObjectNode.js +61 -0
  73. package/dist/components/ObjectsRenderer.d.ts +11 -0
  74. package/dist/components/ObjectsRenderer.d.ts.map +1 -0
  75. package/dist/components/ObjectsRenderer.js +19 -0
  76. package/dist/components/Ocean.d.ts +8 -0
  77. package/dist/components/Ocean.d.ts.map +1 -0
  78. package/dist/components/Ocean.js +111 -0
  79. package/dist/components/ParticlesR3f.d.ts +16 -0
  80. package/dist/components/ParticlesR3f.d.ts.map +1 -0
  81. package/dist/components/ParticlesR3f.js +66 -0
  82. package/dist/components/Path.d.ts +13 -0
  83. package/dist/components/Path.d.ts.map +1 -0
  84. package/dist/components/Path.js +41 -0
  85. package/dist/components/PathGeometry.d.ts +11 -0
  86. package/dist/components/PathGeometry.d.ts.map +1 -0
  87. package/dist/components/PathGeometry.js +109 -0
  88. package/dist/components/PathRenderer.d.ts +14 -0
  89. package/dist/components/PathRenderer.d.ts.map +1 -0
  90. package/dist/components/PathRenderer.js +33 -0
  91. package/dist/components/ProductionScene.d.ts +29 -0
  92. package/dist/components/ProductionScene.d.ts.map +1 -0
  93. package/dist/components/ProductionScene.js +18 -0
  94. package/dist/components/ProjectLoader.d.ts +14 -0
  95. package/dist/components/ProjectLoader.d.ts.map +1 -0
  96. package/dist/components/ProjectLoader.js +76 -0
  97. package/dist/components/Rain.d.ts +8 -0
  98. package/dist/components/Rain.d.ts.map +1 -0
  99. package/dist/components/Rain.js +133 -0
  100. package/dist/components/SceneBuilder.d.ts +5 -0
  101. package/dist/components/SceneBuilder.d.ts.map +1 -0
  102. package/dist/components/SceneBuilder.js +104 -0
  103. package/dist/components/SceneFog.d.ts +8 -0
  104. package/dist/components/SceneFog.d.ts.map +1 -0
  105. package/dist/components/SceneFog.js +19 -0
  106. package/dist/components/ShootingStar.d.ts +16 -0
  107. package/dist/components/ShootingStar.d.ts.map +1 -0
  108. package/dist/components/ShootingStar.js +92 -0
  109. package/dist/components/ShootingStars.d.ts +8 -0
  110. package/dist/components/ShootingStars.d.ts.map +1 -0
  111. package/dist/components/ShootingStars.js +40 -0
  112. package/dist/components/SkyController.d.ts +10 -0
  113. package/dist/components/SkyController.d.ts.map +1 -0
  114. package/dist/components/SkyController.js +159 -0
  115. package/dist/components/SkyMesh.d.ts +11 -0
  116. package/dist/components/SkyMesh.d.ts.map +1 -0
  117. package/dist/components/SkyMesh.js +36 -0
  118. package/dist/components/SkySystem.d.ts +34 -0
  119. package/dist/components/SkySystem.d.ts.map +1 -0
  120. package/dist/components/SkySystem.js +47 -0
  121. package/dist/components/Skybox.d.ts +12 -0
  122. package/dist/components/Skybox.d.ts.map +1 -0
  123. package/dist/components/Skybox.js +79 -0
  124. package/dist/components/Stars.d.ts +14 -0
  125. package/dist/components/Stars.d.ts.map +1 -0
  126. package/dist/components/Stars.js +165 -0
  127. package/dist/components/SunLight.d.ts +15 -0
  128. package/dist/components/SunLight.d.ts.map +1 -0
  129. package/dist/components/SunLight.js +57 -0
  130. package/dist/components/Text2D.d.ts +9 -0
  131. package/dist/components/Text2D.d.ts.map +1 -0
  132. package/dist/components/Text2D.js +56 -0
  133. package/dist/components/Text3D.d.ts +10 -0
  134. package/dist/components/Text3D.d.ts.map +1 -0
  135. package/dist/components/Text3D.js +8 -0
  136. package/dist/components/effects/AuraEffect.d.ts +10 -0
  137. package/dist/components/effects/AuraEffect.d.ts.map +1 -0
  138. package/dist/components/effects/AuraEffect.js +127 -0
  139. package/dist/components/effects/AuroraEffect.d.ts +10 -0
  140. package/dist/components/effects/AuroraEffect.d.ts.map +1 -0
  141. package/dist/components/effects/AuroraEffect.js +112 -0
  142. package/dist/components/effects/BlackHoleEffect.d.ts +10 -0
  143. package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -0
  144. package/dist/components/effects/BlackHoleEffect.js +193 -0
  145. package/dist/components/effects/ConstellationEffect.d.ts +10 -0
  146. package/dist/components/effects/ConstellationEffect.d.ts.map +1 -0
  147. package/dist/components/effects/ConstellationEffect.js +189 -0
  148. package/dist/components/effects/DataStreamEffect.d.ts +10 -0
  149. package/dist/components/effects/DataStreamEffect.d.ts.map +1 -0
  150. package/dist/components/effects/DataStreamEffect.js +138 -0
  151. package/dist/components/effects/DnaHelixEffect.d.ts +10 -0
  152. package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -0
  153. package/dist/components/effects/DnaHelixEffect.js +311 -0
  154. package/dist/components/effects/FireEffect.d.ts +10 -0
  155. package/dist/components/effects/FireEffect.d.ts.map +1 -0
  156. package/dist/components/effects/FireEffect.js +194 -0
  157. package/dist/components/effects/ForcefieldEffect.d.ts +10 -0
  158. package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -0
  159. package/dist/components/effects/ForcefieldEffect.js +132 -0
  160. package/dist/components/effects/HologramEffect.d.ts +10 -0
  161. package/dist/components/effects/HologramEffect.d.ts.map +1 -0
  162. package/dist/components/effects/HologramEffect.js +143 -0
  163. package/dist/components/effects/IceCrystalsEffect.d.ts +10 -0
  164. package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -0
  165. package/dist/components/effects/IceCrystalsEffect.js +190 -0
  166. package/dist/components/effects/LightningEffect.d.ts +10 -0
  167. package/dist/components/effects/LightningEffect.d.ts.map +1 -0
  168. package/dist/components/effects/LightningEffect.js +240 -0
  169. package/dist/components/effects/MoleculesEffect.d.ts +10 -0
  170. package/dist/components/effects/MoleculesEffect.d.ts.map +1 -0
  171. package/dist/components/effects/MoleculesEffect.js +179 -0
  172. package/dist/components/effects/NeuralNetworkEffect.d.ts +10 -0
  173. package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -0
  174. package/dist/components/effects/NeuralNetworkEffect.js +188 -0
  175. package/dist/components/effects/OrbEffect.d.ts +10 -0
  176. package/dist/components/effects/OrbEffect.d.ts.map +1 -0
  177. package/dist/components/effects/OrbEffect.js +291 -0
  178. package/dist/components/effects/PortalEffect.d.ts +10 -0
  179. package/dist/components/effects/PortalEffect.d.ts.map +1 -0
  180. package/dist/components/effects/PortalEffect.js +191 -0
  181. package/dist/components/effects/ShockwaveEffect.d.ts +10 -0
  182. package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -0
  183. package/dist/components/effects/ShockwaveEffect.js +159 -0
  184. package/dist/components/effects/SmokePlumeEffect.d.ts +10 -0
  185. package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -0
  186. package/dist/components/effects/SmokePlumeEffect.js +141 -0
  187. package/dist/components/effects/SmokeRingEffect.d.ts +10 -0
  188. package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -0
  189. package/dist/components/effects/SmokeRingEffect.js +158 -0
  190. package/dist/components/effects/VolumetricFogEffect.d.ts +10 -0
  191. package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -0
  192. package/dist/components/effects/VolumetricFogEffect.js +111 -0
  193. package/dist/constants.d.ts +2 -0
  194. package/dist/constants.d.ts.map +1 -0
  195. package/dist/constants.js +1 -0
  196. package/dist/hooks/index.d.ts +1 -0
  197. package/dist/hooks/index.d.ts.map +1 -0
  198. package/dist/hooks/index.js +1 -0
  199. package/dist/hooks/useAnimationEvents.d.ts +10 -0
  200. package/dist/hooks/useAnimationEvents.d.ts.map +1 -0
  201. package/dist/hooks/useAnimationEvents.js +28 -0
  202. package/dist/hooks/useCameraAnimation.d.ts +35 -0
  203. package/dist/hooks/useCameraAnimation.d.ts.map +1 -0
  204. package/dist/hooks/useCameraAnimation.js +268 -0
  205. package/dist/hooks/useContinuousEffects.d.ts +15 -0
  206. package/dist/hooks/useContinuousEffects.d.ts.map +1 -0
  207. package/dist/hooks/useContinuousEffects.js +173 -0
  208. package/dist/hooks/useCubeCamera.d.ts +19 -0
  209. package/dist/hooks/useCubeCamera.d.ts.map +1 -0
  210. package/dist/hooks/useCubeCamera.js +73 -0
  211. package/dist/hooks/useEnvironmentEffects.d.ts +12 -0
  212. package/dist/hooks/useEnvironmentEffects.d.ts.map +1 -0
  213. package/dist/hooks/useEnvironmentEffects.js +22 -0
  214. package/dist/hooks/useFrameEffects.d.ts +6 -0
  215. package/dist/hooks/useFrameEffects.d.ts.map +1 -0
  216. package/dist/hooks/useFrameEffects.js +19 -0
  217. package/dist/hooks/useInteractionEffects.d.ts +11 -0
  218. package/dist/hooks/useInteractionEffects.d.ts.map +1 -0
  219. package/dist/hooks/useInteractionEffects.js +35 -0
  220. package/dist/hooks/useKey.d.ts +26 -0
  221. package/dist/hooks/useKey.d.ts.map +1 -0
  222. package/dist/hooks/useKey.js +73 -0
  223. package/dist/hooks/useLightHandlers.d.ts +14 -0
  224. package/dist/hooks/useLightHandlers.d.ts.map +1 -0
  225. package/dist/hooks/useLightHandlers.js +116 -0
  226. package/dist/hooks/useMaterialApplication.d.ts +9 -0
  227. package/dist/hooks/useMaterialApplication.d.ts.map +1 -0
  228. package/dist/hooks/useMaterialApplication.js +113 -0
  229. package/dist/hooks/useMaterialOptions.d.ts +13 -0
  230. package/dist/hooks/useMaterialOptions.d.ts.map +1 -0
  231. package/dist/hooks/useMaterialOptions.js +110 -0
  232. package/dist/hooks/useMaterialUniforms.d.ts +18 -0
  233. package/dist/hooks/useMaterialUniforms.d.ts.map +1 -0
  234. package/dist/hooks/useMaterialUniforms.js +96 -0
  235. package/dist/hooks/useMeshController.d.ts +3 -0
  236. package/dist/hooks/useMeshController.d.ts.map +1 -0
  237. package/dist/hooks/useMeshController.js +152 -0
  238. package/dist/hooks/useMouseHandlers.d.ts +8 -0
  239. package/dist/hooks/useMouseHandlers.d.ts.map +1 -0
  240. package/dist/hooks/useMouseHandlers.js +47 -0
  241. package/dist/hooks/useObjectAnimation.d.ts +13 -0
  242. package/dist/hooks/useObjectAnimation.d.ts.map +1 -0
  243. package/dist/hooks/useObjectAnimation.js +11 -0
  244. package/dist/hooks/useObjectEdges.d.ts +4 -0
  245. package/dist/hooks/useObjectEdges.d.ts.map +1 -0
  246. package/dist/hooks/useObjectEdges.js +199 -0
  247. package/dist/hooks/useOrbitControls.d.ts +7 -0
  248. package/dist/hooks/useOrbitControls.d.ts.map +1 -0
  249. package/dist/hooks/useOrbitControls.js +9 -0
  250. package/dist/hooks/useParticlePositions.d.ts +19 -0
  251. package/dist/hooks/useParticlePositions.d.ts.map +1 -0
  252. package/dist/hooks/useParticlePositions.js +56 -0
  253. package/dist/hooks/useParticlesColors.d.ts +14 -0
  254. package/dist/hooks/useParticlesColors.d.ts.map +1 -0
  255. package/dist/hooks/useParticlesColors.js +27 -0
  256. package/dist/hooks/useParticlesTextures.d.ts +10 -0
  257. package/dist/hooks/useParticlesTextures.d.ts.map +1 -0
  258. package/dist/hooks/useParticlesTextures.js +23 -0
  259. package/dist/hooks/usePathAnimation.d.ts +26 -0
  260. package/dist/hooks/usePathAnimation.d.ts.map +1 -0
  261. package/dist/hooks/usePathAnimation.js +120 -0
  262. package/dist/hooks/useSkyAnimation.d.ts +14 -0
  263. package/dist/hooks/useSkyAnimation.d.ts.map +1 -0
  264. package/dist/hooks/useSkyAnimation.js +46 -0
  265. package/dist/hooks/useSkySystem.d.ts +26 -0
  266. package/dist/hooks/useSkySystem.d.ts.map +1 -0
  267. package/dist/hooks/useSkySystem.js +57 -0
  268. package/dist/hooks/useSkyUniforms.d.ts +18 -0
  269. package/dist/hooks/useSkyUniforms.d.ts.map +1 -0
  270. package/dist/hooks/useSkyUniforms.js +59 -0
  271. package/dist/hooks/useTransformControls.d.ts +6 -0
  272. package/dist/hooks/useTransformControls.d.ts.map +1 -0
  273. package/dist/hooks/useTransformControls.js +111 -0
  274. package/dist/hooks/useWaterEnvironment.d.ts +5 -0
  275. package/dist/hooks/useWaterEnvironment.d.ts.map +1 -0
  276. package/dist/hooks/useWaterEnvironment.js +27 -0
  277. package/dist/hooks/useWaterReflections.d.ts +17 -0
  278. package/dist/hooks/useWaterReflections.d.ts.map +1 -0
  279. package/dist/hooks/useWaterReflections.js +77 -0
  280. package/dist/index.d.ts +140 -0
  281. package/dist/index.d.ts.map +1 -0
  282. package/dist/index.js +109 -0
  283. package/dist/services/AnimationsManager.d.ts +33 -0
  284. package/dist/services/AnimationsManager.d.ts.map +1 -0
  285. package/dist/services/AnimationsManager.js +58 -0
  286. package/dist/services/FontManager.d.ts +32 -0
  287. package/dist/services/FontManager.d.ts.map +1 -0
  288. package/dist/services/FontManager.js +76 -0
  289. package/dist/services/TexturesManager.d.ts +17 -0
  290. package/dist/services/TexturesManager.d.ts.map +1 -0
  291. package/dist/services/TexturesManager.js +48 -0
  292. package/dist/shaders/RainMaterial.d.ts +34 -0
  293. package/dist/shaders/RainMaterial.d.ts.map +1 -0
  294. package/dist/shaders/RainMaterial.js +56 -0
  295. package/dist/shaders/ShaderEffectsMaterial.d.ts +279 -0
  296. package/dist/shaders/ShaderEffectsMaterial.d.ts.map +1 -0
  297. package/dist/shaders/ShaderEffectsMaterial.js +257 -0
  298. package/dist/shaders/ShootingStarMaterial.d.ts +14 -0
  299. package/dist/shaders/ShootingStarMaterial.d.ts.map +1 -0
  300. package/dist/shaders/ShootingStarMaterial.js +33 -0
  301. package/dist/shaders/SkyboxMaterial.d.ts +38 -0
  302. package/dist/shaders/SkyboxMaterial.d.ts.map +1 -0
  303. package/dist/shaders/SkyboxMaterial.js +57 -0
  304. package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts +2 -0
  305. package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts.map +1 -0
  306. package/dist/shaders/effects/EffectsVertexFunctions.glsl.js +167 -0
  307. package/dist/utils/CameraSingleton.d.ts +35 -0
  308. package/dist/utils/CameraSingleton.d.ts.map +1 -0
  309. package/dist/utils/CameraSingleton.js +178 -0
  310. package/dist/utils/anchorUtils.d.ts +10 -0
  311. package/dist/utils/anchorUtils.d.ts.map +1 -0
  312. package/dist/utils/anchorUtils.js +13 -0
  313. package/dist/utils/frameAnimations.d.ts +49 -0
  314. package/dist/utils/frameAnimations.d.ts.map +1 -0
  315. package/dist/utils/frameAnimations.js +213 -0
  316. package/dist/utils/handleGenerativeEffectsAnimations.d.ts +5 -0
  317. package/dist/utils/handleGenerativeEffectsAnimations.d.ts.map +1 -0
  318. package/dist/utils/handleGenerativeEffectsAnimations.js +268 -0
  319. package/dist/utils/hasHoverAnimation.d.ts +3 -0
  320. package/dist/utils/hasHoverAnimation.d.ts.map +1 -0
  321. package/dist/utils/hasHoverAnimation.js +15 -0
  322. package/dist/utils/particleAnimations.d.ts +3 -0
  323. package/dist/utils/particleAnimations.d.ts.map +1 -0
  324. package/dist/utils/particleAnimations.js +17 -0
  325. package/dist/utils/sceneQuery.d.ts +9 -0
  326. package/dist/utils/sceneQuery.d.ts.map +1 -0
  327. package/dist/utils/sceneQuery.js +22 -0
  328. package/dist/utils/shaderUtils.d.ts +6 -0
  329. package/dist/utils/shaderUtils.d.ts.map +1 -0
  330. package/dist/utils/shaderUtils.js +145 -0
  331. package/dist/utils/textEffects.d.ts +31 -0
  332. package/dist/utils/textEffects.d.ts.map +1 -0
  333. package/dist/utils/textEffects.js +61 -0
  334. package/dist/utils/utils3d.d.ts +7 -0
  335. package/dist/utils/utils3d.d.ts.map +1 -0
  336. package/dist/utils/utils3d.js +34 -0
  337. package/package.json +43 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContinuousEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useContinuousEffects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAyK,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAU7P,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAY9C,MAAM,WAAW,2BAA2B;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,0BAA0B;IACvC,eAAe,EAAE,MAAM,OAAO,CAAC;IAC/B,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC9D;AAGD,eAAO,MAAM,oBAAoB,GAE7B,gBAAgB,qBAAqB,GAAG,IAAI,EAC5C,SAAS,2BAA2B,YAAK,EACzC,QAAQ,QAAQ,KACjB,0BA0NF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { useRef, useEffect } from "react";
2
+ import { useFrame } from "@react-three/fiber";
3
+ import { animateUniforms, cacheChildrenWithMaterials, handleEdgesAnimations, handleMaterialAnimations, handleMaterialEffects, handleTransformAnimations, handleTransformEffect } from "@ntalmagor/3drize-core";
4
+ import usePathAnimation from "./usePathAnimation";
5
+ // ═══════════════════════════════════════════════════════════════════════════════
6
+ // DEBUG LOGGING
7
+ // ═══════════════════════════════════════════════════════════════════════════════
8
+ export const DEBUG_CONTINUOUS_EFFECTS = false;
9
+ const log = (message, ...args) => {
10
+ if (DEBUG_CONTINUOUS_EFFECTS) {
11
+ console.log(`[ObjectAnimations] ${message}`, ...args);
12
+ }
13
+ };
14
+ export const useContinuousEffects = (
15
+ // object: Object3D | null,
16
+ objectSettings, options = {}, object) => {
17
+ const { enabled = true, animateMaterial = true, hovered = false } = options;
18
+ // console.log("useObjectAnimation called with:", {
19
+ // object
20
+ // });
21
+ // const { object } = ref || {};
22
+ // Path animation hook for animations with pathId
23
+ const { startPathAnimation, updatePathAnimation, isAnimating: isPathAnimating, stopPathAnimation, } = usePathAnimation();
24
+ // ─────────────────────────────────────────────────────────────────────────────
25
+ // REFS
26
+ // ─────────────────────────────────────────────────────────────────────────────
27
+ // Track which path animation is currently active
28
+ const activePathIdRef = useRef(null);
29
+ const effectStateRef = useRef(null);
30
+ // Cache children with materials to avoid traverse() every frame
31
+ const childrenWithMaterialsRef = useRef([]);
32
+ const lastObjectRef = useRef(null);
33
+ // Cache start values for material animations
34
+ const startValuesRef = useRef({});
35
+ // Cache start values for edges animations
36
+ const edgesStartValuesRef = useRef({});
37
+ // ─────────────────────────────────────────────────────────────────────────────
38
+ // DERIVED STATE (read from new continuous structure)
39
+ // ─────────────────────────────────────────────────────────────────────────────
40
+ // Transform domain - now supports multiple effects (one per category)
41
+ const transformAnimations = objectSettings?.animations?.transform?.animations || [];
42
+ const transformEffects = objectSettings?.animations?.transform?.effects || [];
43
+ const enabledTransformEffects = transformEffects.filter(effect => effect.enabled);
44
+ const hasTransformEffects = enabledTransformEffects.length > 0;
45
+ // Skip transform animations if any effect is enabled (effects take precedence)
46
+ const activeTransformAnimations = hasTransformEffects ? [] : transformAnimations;
47
+ const hasTransformAnimations = activeTransformAnimations.length > 0;
48
+ // Edges domain
49
+ const edgesAnimations = objectSettings?.animations?.edges?.animations || [];
50
+ const hasEdgesAnimations = edgesAnimations.length > 0;
51
+ // const effectsAnimations = objectSettings?.effects?.animations || [];
52
+ // const hasEffectsAnimations = effectsAnimations.length > 0;
53
+ // Material domain
54
+ const materialAnimations = objectSettings?.animations?.material?.animations || [];
55
+ const materialEffects = objectSettings?.animations?.material?.effects || [];
56
+ const enabledMaterialEffects = materialEffects.filter(effect => effect.enabled);
57
+ const hasMaterialEffects = enabledMaterialEffects.length > 0;
58
+ // Skip material animations if any effect is enabled (effects take precedence)
59
+ const activeMaterialAnimations = hasMaterialEffects ? [] : materialAnimations;
60
+ const hasMaterialAnimations = activeMaterialAnimations.length > 0;
61
+ // Combined check for any animations
62
+ const hasAnimations = hasTransformAnimations || hasMaterialAnimations;
63
+ // Continuous effects config
64
+ const applyToChildren = false;
65
+ // ─────────────────────────────────────────────────────────────────────────────
66
+ // CACHE CHILDREN WITH MATERIALS
67
+ // ─────────────────────────────────────────────────────────────────────────────
68
+ useEffect(() => {
69
+ if (!object || object === lastObjectRef.current)
70
+ return;
71
+ lastObjectRef.current = object;
72
+ childrenWithMaterialsRef.current = cacheChildrenWithMaterials(object);
73
+ log('cached children with materials', {
74
+ count: childrenWithMaterialsRef.current.length,
75
+ objectName: object.name
76
+ });
77
+ // Reset start values cache when object changes
78
+ startValuesRef.current = {};
79
+ edgesStartValuesRef.current = {};
80
+ }, [object]);
81
+ // ─────────────────────────────────────────────────────────────────────────────
82
+ // PATH ANIMATION LIFECYCLE
83
+ // ─────────────────────────────────────────────────────────────────────────────
84
+ useEffect(() => {
85
+ if (!enabled || !object)
86
+ return;
87
+ // Path animations come from transform.animations
88
+ const animations = objectSettings?.animations?.transform?.animations || [];
89
+ const pathAnimation = animations.find(anim => anim.pathId && anim.active);
90
+ if (pathAnimation?.pathId) {
91
+ // Start path animation if not already active or if pathId changed
92
+ if (activePathIdRef.current !== pathAnimation.pathId) {
93
+ activePathIdRef.current = pathAnimation.pathId;
94
+ log('starting path animation', { pathId: pathAnimation.pathId, duration: pathAnimation.duration });
95
+ startPathAnimation(pathAnimation.pathId, pathAnimation.duration / 1000, {
96
+ ease: pathAnimation.ease,
97
+ loop: pathAnimation.loop,
98
+ yoyo: pathAnimation.yoyo,
99
+ applyRotation: pathAnimation.applyRotation,
100
+ offset: pathAnimation.offset,
101
+ keepOriginalTransform: pathAnimation.keepOriginalTransform,
102
+ });
103
+ }
104
+ }
105
+ else if (activePathIdRef.current) {
106
+ // Stop path animation if no longer active
107
+ // log('stopping path animation', { pathId: activePathIdRef.current });
108
+ stopPathAnimation();
109
+ activePathIdRef.current = null;
110
+ }
111
+ }, [enabled, objectSettings?.animations?.transform?.animations, object, startPathAnimation, stopPathAnimation]);
112
+ useFrame((state, delta) => {
113
+ // console.log({
114
+ // enabled,
115
+ // object,
116
+ // objectSettings,
117
+ // })
118
+ if (!enabled || !object || !objectSettings)
119
+ return;
120
+ const time = state.clock.getElapsedTime();
121
+ const mouse = state.pointer;
122
+ const currentTime = Date.now();
123
+ // Update path animation if active
124
+ const pathIsActive = isPathAnimating();
125
+ if (pathIsActive) {
126
+ updatePathAnimation(delta, object);
127
+ }
128
+ // ─────────────────────────────────────────────────────────────────────────
129
+ // TRANSFORM DOMAIN
130
+ // ─────────────────────────────────────────────────────────────────────────
131
+ if (hasTransformAnimations) {
132
+ handleTransformAnimations({
133
+ object,
134
+ meshSettings: objectSettings.meshSettings || {},
135
+ pathIsActive,
136
+ }, activeTransformAnimations, currentTime, hovered);
137
+ }
138
+ // Handle transform effect (wave, float, spin, etc.) - now supports multiple effects
139
+ if (hasTransformEffects) {
140
+ handleTransformEffect(object, enabledTransformEffects, time, delta, effectStateRef, hovered);
141
+ }
142
+ // ─────────────────────────────────────────────────────────────────────────
143
+ // MATERIAL DOMAIN
144
+ // ─────────────────────────────────────────────────────────────────────────
145
+ if (animateMaterial) {
146
+ // Handle material animations (any material property)
147
+ if (hasMaterialAnimations) {
148
+ handleMaterialAnimations({
149
+ object,
150
+ materialSettings: objectSettings.materialSettings || {},
151
+ startValuesCache: startValuesRef.current,
152
+ }, activeMaterialAnimations, currentTime, hovered);
153
+ }
154
+ // Handle material effects (color effects)
155
+ if (enabledMaterialEffects.length > 0) {
156
+ handleMaterialEffects(object, enabledMaterialEffects, time, delta, effectStateRef, applyToChildren);
157
+ }
158
+ // ─────────────────────────────────────────────────────────────────────────
159
+ // EDGES DOMAIN
160
+ // ─────────────────────────────────────────────────────────────────────────
161
+ if (hasEdgesAnimations) {
162
+ handleEdgesAnimations({ object, startValuesCache: edgesStartValuesRef.current }, edgesAnimations, currentTime, hovered);
163
+ }
164
+ // Animate uniforms (u_time, u_mouse, u_camera_position)
165
+ animateUniforms(childrenWithMaterialsRef.current, time, mouse, state.camera.position);
166
+ }
167
+ });
168
+ return {
169
+ isPathAnimating,
170
+ effectStateRef,
171
+ };
172
+ };
173
+ export default useContinuousEffects;
@@ -0,0 +1,19 @@
1
+ import * as THREE from 'three';
2
+ import type { TimeSettings } from '../../../core/src/types/scene3d';
3
+ import type { HdrSettings } from '../../../core/src/types/environment';
4
+ export interface UseCubeCameraOptions {
5
+ hdrSettings: HdrSettings;
6
+ skyVisible: boolean;
7
+ sunSystemVisible: boolean;
8
+ timeSettings: TimeSettings;
9
+ resolution?: number;
10
+ position?: THREE.Vector3;
11
+ onEnvironmentUpdate?: (texture: THREE.Texture) => void;
12
+ }
13
+ export declare const useCubeCamera: (options: UseCubeCameraOptions) => {
14
+ cubeCamera: THREE.CubeCamera | null;
15
+ updateEnvironment: () => THREE.Texture | null;
16
+ initializeCubeCamera: () => THREE.CubeCamera | null;
17
+ dispose: () => void;
18
+ };
19
+ //# sourceMappingURL=useCubeCamera.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCubeCamera.d.ts","sourceRoot":"","sources":["../../src/hooks/useCubeCamera.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC;CACxD;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,oBAAoB;;;;;CAqE1D,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { useRef, useCallback, useEffect } from 'react';
2
+ import { useThree, useFrame } from '@react-three/fiber';
3
+ import * as THREE from 'three';
4
+ import { createCubeCamera, updateCubeCamera, disposeCubeCamera, setSceneEnvironment, clearSceneEnvironment, } from '../../../core/src/utils/environmentUtils';
5
+ export const useCubeCamera = (options) => {
6
+ const { hdrSettings, skyVisible, sunSystemVisible, timeSettings, resolution = 512, position = new THREE.Vector3(0, 50, 0), onEnvironmentUpdate } = options;
7
+ const { scene, gl: renderer } = useThree();
8
+ const cubeCameraRef = useRef(null);
9
+ const isUpdatingRef = useRef(false);
10
+ const backgroundName = hdrSettings.visible ? hdrSettings.name : null;
11
+ const initializeCubeCamera = useCallback(() => {
12
+ if (!renderer || !scene)
13
+ return null;
14
+ if (cubeCameraRef.current)
15
+ disposeCubeCamera(cubeCameraRef.current, scene);
16
+ cubeCameraRef.current = createCubeCamera(scene, resolution, position);
17
+ return cubeCameraRef.current;
18
+ }, [scene, renderer, resolution, position]);
19
+ const updateEnvironment = useCallback(() => {
20
+ if (!cubeCameraRef.current || !renderer || !scene)
21
+ return null;
22
+ if (isUpdatingRef.current)
23
+ return null;
24
+ try {
25
+ isUpdatingRef.current = true;
26
+ const texture = updateCubeCamera(cubeCameraRef.current, renderer, scene);
27
+ setSceneEnvironment(scene, texture);
28
+ onEnvironmentUpdate?.(texture);
29
+ return texture;
30
+ }
31
+ catch {
32
+ return null;
33
+ }
34
+ finally {
35
+ isUpdatingRef.current = false;
36
+ }
37
+ }, [scene, renderer, onEnvironmentUpdate]);
38
+ const dispose = useCallback(() => {
39
+ if (cubeCameraRef.current && scene) {
40
+ disposeCubeCamera(cubeCameraRef.current, scene);
41
+ cubeCameraRef.current = null;
42
+ }
43
+ }, [scene]);
44
+ // Create or dispose cube camera based on active sky / HDR state
45
+ useEffect(() => {
46
+ if (backgroundName) {
47
+ dispose();
48
+ return;
49
+ }
50
+ if (skyVisible || sunSystemVisible) {
51
+ initializeCubeCamera();
52
+ updateEnvironment();
53
+ }
54
+ else {
55
+ dispose();
56
+ clearSceneEnvironment(scene);
57
+ }
58
+ }, [backgroundName, skyVisible, sunSystemVisible]);
59
+ // Live update when auto-animating (sky moves, environment changes)
60
+ const UPDATE_INTERVAL_MS = 300;
61
+ useFrame((state) => {
62
+ if (backgroundName || !(skyVisible || sunSystemVisible))
63
+ return;
64
+ if (!timeSettings.autoAnimate)
65
+ return;
66
+ if (state.clock.getElapsedTime() * 1000 > UPDATE_INTERVAL_MS) {
67
+ updateEnvironment();
68
+ }
69
+ });
70
+ // Cleanup on unmount
71
+ useEffect(() => () => dispose(), [dispose]);
72
+ return { cubeCamera: cubeCameraRef.current, updateEnvironment, initializeCubeCamera, dispose };
73
+ };
@@ -0,0 +1,12 @@
1
+ import type { TimeSettings } from '../../../core/src/types/scene3d';
2
+ export interface UseEnvironmentEffectsOptions {
3
+ updateEnvironment: () => void;
4
+ skyVisible: boolean;
5
+ sunSystemVisible: boolean;
6
+ timeSettings: TimeSettings;
7
+ updateDelay?: number;
8
+ }
9
+ export declare const useEnvironmentEffects: (options: UseEnvironmentEffectsOptions) => {
10
+ triggerUpdate: () => void;
11
+ };
12
+ //# sourceMappingURL=useEnvironmentEffects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEnvironmentEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useEnvironmentEffects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,GAAI,SAAS,4BAA4B;;CAwB1E,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { useRef, useCallback, useEffect } from 'react';
2
+ import { createDebouncedUpdate } from '../../../core/src/utils/environmentUtils';
3
+ export const useEnvironmentEffects = (options) => {
4
+ const { updateEnvironment, skyVisible, sunSystemVisible, timeSettings, updateDelay = 50 } = options;
5
+ const debouncedUpdate = useRef(createDebouncedUpdate(updateEnvironment, updateDelay));
6
+ useEffect(() => {
7
+ debouncedUpdate.current = createDebouncedUpdate(updateEnvironment, updateDelay);
8
+ }, [updateEnvironment, updateDelay]);
9
+ // Trigger debounced update when sky visibility changes
10
+ useEffect(() => {
11
+ debouncedUpdate.current();
12
+ }, [skyVisible, sunSystemVisible]);
13
+ // Trigger update when time settings change
14
+ useEffect(() => {
15
+ if (timeSettings.enabled)
16
+ updateEnvironment();
17
+ }, [timeSettings, updateEnvironment]);
18
+ const triggerUpdate = useCallback(() => {
19
+ updateEnvironment();
20
+ }, [updateEnvironment]);
21
+ return { triggerUpdate };
22
+ };
@@ -0,0 +1,6 @@
1
+ export declare function useFrameEffects(isActive: boolean): {
2
+ handlePointerEnter: (e: any) => void;
3
+ handlePointerLeave: () => void;
4
+ hovered: boolean;
5
+ };
6
+ //# sourceMappingURL=useFrameEffects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFrameEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useFrameEffects.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO;4BAIJ,GAAG;;;EAgB/C"}
@@ -0,0 +1,19 @@
1
+ import { useCallback, useState, useRef } from "react";
2
+ export function useFrameEffects(isActive) {
3
+ const [hovered, setHovered] = useState(false);
4
+ const hoveredRef = useRef(false);
5
+ const handlePointerEnter = useCallback((e) => {
6
+ e.stopPropagation();
7
+ if (!isActive && !hoveredRef.current) {
8
+ hoveredRef.current = true;
9
+ setHovered(true);
10
+ }
11
+ }, [isActive]);
12
+ const handlePointerLeave = useCallback(() => {
13
+ if (!isActive && hoveredRef.current) {
14
+ hoveredRef.current = false;
15
+ setHovered(false);
16
+ }
17
+ }, [isActive]);
18
+ return { handlePointerEnter, handlePointerLeave, hovered };
19
+ }
@@ -0,0 +1,11 @@
1
+ import { Object3D } from "three";
2
+ import type { CreatedObjectSettings } from '@ntalmagor/3drize-core';
3
+ export interface UseInteractionEffectsOptions {
4
+ enabled?: boolean;
5
+ animateMaterial?: boolean;
6
+ }
7
+ export interface UseInteractionEffectsResult {
8
+ }
9
+ export declare const useInteractionEffects: (objectSettings: CreatedObjectSettings | null, options: UseInteractionEffectsOptions | undefined, object: Object3D) => UseInteractionEffectsResult;
10
+ export default useInteractionEffects;
11
+ //# sourceMappingURL=useInteractionEffects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInteractionEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useInteractionEffects.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,WAAW,4BAA4B;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,2BAA2B;CAE3C;AAED,eAAO,MAAM,qBAAqB,GAChC,gBAAgB,qBAAqB,GAAG,IAAI,EAC5C,SAAS,4BAA4B,YAAK,EAC1C,QAAQ,QAAQ,KACf,2BAkCF,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { useCallback } from "react";
2
+ import { useFrame } from "@react-three/fiber";
3
+ export const useInteractionEffects = (objectSettings, options = {}, object) => {
4
+ const { enabled = true, animateMaterial = true } = options;
5
+ const mouseMove = objectSettings?.interactions?.mouseMove;
6
+ const handleMouseMove = useCallback((pointer) => {
7
+ if (!objectSettings || !mouseMove?.enabled || !mouseMove.properties?.length || !object)
8
+ return;
9
+ mouseMove.properties.forEach(({ property, propertySettings }) => {
10
+ const { axis, sensitivity = 1, inverted = false, min: minVal, max: maxVal } = propertySettings || {};
11
+ const rawValue = axis === 'x' ? pointer.x : axis === 'y' ? pointer.y : pointer.x;
12
+ const t = ((inverted ? -rawValue : rawValue) * sensitivity + 1) / 2; // 0..1
13
+ const isMeshProp = property in object;
14
+ const isMaterialProp = !isMeshProp && object.material && property in object.material;
15
+ if (typeof minVal === 'number' && typeof maxVal === 'number') {
16
+ const value = minVal + t * (maxVal - minVal);
17
+ if (isMeshProp) {
18
+ object[property] = value;
19
+ }
20
+ else if (isMaterialProp && animateMaterial) {
21
+ object.material[property] = value;
22
+ object.material.needsUpdate = true;
23
+ }
24
+ }
25
+ });
26
+ }, [object, objectSettings, mouseMove, animateMaterial]);
27
+ useFrame((state) => {
28
+ if (!enabled || !object || !objectSettings)
29
+ return;
30
+ if (mouseMove?.enabled)
31
+ handleMouseMove(state.pointer);
32
+ });
33
+ return {};
34
+ };
35
+ export default useInteractionEffects;
@@ -0,0 +1,26 @@
1
+ type KeyHandler = (event: KeyboardEvent) => void;
2
+ interface UseKeyOptions {
3
+ /** Whether the hook should be active */
4
+ enabled?: boolean;
5
+ /** Target element to attach the event listener to (defaults to window) */
6
+ target?: EventTarget | null;
7
+ /** Prevent default behavior */
8
+ preventDefault?: boolean;
9
+ /** Stop event propagation */
10
+ stopPropagation?: boolean;
11
+ }
12
+ /**
13
+ * Custom hook for handling keyboard events
14
+ * @param keyHandlers - Object mapping key names to handler functions
15
+ * @param options - Configuration options
16
+ */
17
+ export declare const useKey: (keyHandlers: Record<string, KeyHandler>, options?: UseKeyOptions) => void;
18
+ /**
19
+ * Custom hook for handling both keydown and keyup events
20
+ * @param keyDownHandlers - Object mapping key names to keydown handler functions
21
+ * @param keyUpHandlers - Object mapping key names to keyup handler functions
22
+ * @param options - Configuration options
23
+ */
24
+ export declare const useKeyUpDown: (keyDownHandlers: Record<string, KeyHandler>, keyUpHandlers?: Record<string, KeyHandler>, options?: UseKeyOptions) => void;
25
+ export default useKey;
26
+ //# sourceMappingURL=useKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKey.d.ts","sourceRoot":"","sources":["../../src/hooks/useKey.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAEjD,UAAU,aAAa;IACrB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,+BAA+B;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6BAA6B;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,GACjB,aAAa,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACvC,UAAS,aAAkB,SAgC5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,iBAAiB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAC3C,gBAAe,MAAM,CAAC,MAAM,EAAE,UAAU,CAAM,EAC9C,UAAS,aAAkB,SAgD5B,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { useEffect, useCallback } from 'react';
2
+ /**
3
+ * Custom hook for handling keyboard events
4
+ * @param keyHandlers - Object mapping key names to handler functions
5
+ * @param options - Configuration options
6
+ */
7
+ export const useKey = (keyHandlers, options = {}) => {
8
+ const { enabled = true, target = typeof window !== 'undefined' ? window : null, preventDefault = false, stopPropagation = false, } = options;
9
+ const handleKeyDown = useCallback((event) => {
10
+ if (!enabled)
11
+ return;
12
+ const handler = keyHandlers[event.key];
13
+ if (handler) {
14
+ if (preventDefault)
15
+ event.preventDefault();
16
+ if (stopPropagation)
17
+ event.stopPropagation();
18
+ handler(event);
19
+ }
20
+ }, [keyHandlers, enabled, preventDefault, stopPropagation]);
21
+ useEffect(() => {
22
+ if (!target || !enabled)
23
+ return;
24
+ target.addEventListener('keydown', handleKeyDown);
25
+ return () => {
26
+ target.removeEventListener('keydown', handleKeyDown);
27
+ };
28
+ }, [target, enabled, handleKeyDown]);
29
+ };
30
+ /**
31
+ * Custom hook for handling both keydown and keyup events
32
+ * @param keyDownHandlers - Object mapping key names to keydown handler functions
33
+ * @param keyUpHandlers - Object mapping key names to keyup handler functions
34
+ * @param options - Configuration options
35
+ */
36
+ export const useKeyUpDown = (keyDownHandlers, keyUpHandlers = {}, options = {}) => {
37
+ const { enabled = true, target = typeof window !== 'undefined' ? window : null, preventDefault = false, stopPropagation = false, } = options;
38
+ const handleKeyDown = useCallback((event) => {
39
+ if (!enabled)
40
+ return;
41
+ const handler = keyDownHandlers[event.key];
42
+ if (handler) {
43
+ if (preventDefault)
44
+ event.preventDefault();
45
+ if (stopPropagation)
46
+ event.stopPropagation();
47
+ handler(event);
48
+ }
49
+ }, [keyDownHandlers, enabled, preventDefault, stopPropagation]);
50
+ const handleKeyUp = useCallback((event) => {
51
+ if (!enabled)
52
+ return;
53
+ const handler = keyUpHandlers[event.key];
54
+ if (handler) {
55
+ if (preventDefault)
56
+ event.preventDefault();
57
+ if (stopPropagation)
58
+ event.stopPropagation();
59
+ handler(event);
60
+ }
61
+ }, [keyUpHandlers, enabled, preventDefault, stopPropagation]);
62
+ useEffect(() => {
63
+ if (!target || !enabled)
64
+ return;
65
+ target.addEventListener('keydown', handleKeyDown);
66
+ target.addEventListener('keyup', handleKeyUp);
67
+ return () => {
68
+ target.removeEventListener('keydown', handleKeyDown);
69
+ target.removeEventListener('keyup', handleKeyUp);
70
+ };
71
+ }, [target, enabled, handleKeyDown, handleKeyUp]);
72
+ };
73
+ export default useKey;
@@ -0,0 +1,14 @@
1
+ import { type MutableRefObject } from 'react';
2
+ import type { BaseLightConfig, SpotLightConfig, PointLightConfig } from '@ntalmagor/3drize-core';
3
+ import type { DirectionalLight, SpotLight, PointLight } from 'three';
4
+ interface LightRefsInput {
5
+ directionalLightRefs: MutableRefObject<Map<string, DirectionalLight>>;
6
+ spotLightRefs: MutableRefObject<Map<string, SpotLight>>;
7
+ pointLightRefs: MutableRefObject<Map<string, PointLight>>;
8
+ }
9
+ export declare const useLightHandlers: (lightRefs: LightRefsInput, lightConfigs: (BaseLightConfig | SpotLightConfig | PointLightConfig)[]) => {
10
+ handleLightEnter: (lightName: string) => void;
11
+ handleLightLeave: (lightName: string) => void;
12
+ };
13
+ export default useLightHandlers;
14
+ //# sourceMappingURL=useLightHandlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLightHandlers.d.ts","sourceRoot":"","sources":["../../src/hooks/useLightHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AACjH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAgB,MAAM,OAAO,CAAC;AAInF,UAAU,cAAc;IACtB,oBAAoB,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACtE,aAAa,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,cAAc,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAC3D;AAOD,eAAO,MAAM,gBAAgB,GAC3B,WAAW,cAAc,EACzB,cAAc,CAAC,eAAe,GAAG,eAAe,GAAG,gBAAgB,CAAC,EAAE;kCA+FxD,MAAM;kCAYN,MAAM;CAsBrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,116 @@
1
+ import { useCallback, useRef } from 'react';
2
+ import { Color, MathUtils } from 'three';
3
+ import { useFrame } from '@react-three/fiber';
4
+ const getLightFromRefs = (refs, lightName) => refs.directionalLightRefs.current.get(lightName) ||
5
+ refs.spotLightRefs.current.get(lightName) ||
6
+ refs.pointLightRefs.current.get(lightName);
7
+ export const useLightHandlers = (lightRefs, lightConfigs) => {
8
+ const hoveredLightRef = useRef(null);
9
+ const getInterpolatedValue = (baseValue, minValue, maxValue, multiplier, sensitivity = 1) => {
10
+ const normalizedMultiplier = (multiplier + 1) / 2;
11
+ const finalMultiplier = Math.max(0, Math.min(1, normalizedMultiplier * sensitivity));
12
+ if ((typeof minValue === 'string' && minValue.startsWith('#')) ||
13
+ (typeof maxValue === 'string' && maxValue.startsWith('#'))) {
14
+ const minColor = new Color(minValue);
15
+ const maxColor = new Color(maxValue);
16
+ const minArr = minColor.toArray();
17
+ const maxArr = maxColor.toArray();
18
+ return new Color().fromArray(minArr.map((min, i) => MathUtils.lerp(min, maxArr[i], finalMultiplier)));
19
+ }
20
+ if (Array.isArray(minValue) && Array.isArray(maxValue) && minValue.length === 3) {
21
+ return [
22
+ MathUtils.lerp(minValue[0], maxValue[0], finalMultiplier),
23
+ MathUtils.lerp(minValue[1], maxValue[1], finalMultiplier),
24
+ MathUtils.lerp(minValue[2], maxValue[2], finalMultiplier),
25
+ ];
26
+ }
27
+ if (typeof minValue === 'number' && typeof maxValue === 'number') {
28
+ return MathUtils.lerp(minValue, maxValue, finalMultiplier);
29
+ }
30
+ return baseValue;
31
+ };
32
+ const applyHandlerToLight = (light, config, handlers, pointer, handlerType) => {
33
+ const handler = handlers[handlerType];
34
+ if (!handler?.enabled || !handler.properties?.length)
35
+ return;
36
+ handler.properties.forEach((props) => {
37
+ const { property, propertySettings } = props;
38
+ const { min: minValue, max: maxValue, axis, sensitivity = 1, inverted = false } = propertySettings;
39
+ let multiplier = 0;
40
+ if (handlerType === 'onMouseMove') {
41
+ if (axis === 'x')
42
+ multiplier = pointer.x;
43
+ if (axis === 'y')
44
+ multiplier = pointer.y;
45
+ if (axis === 'both')
46
+ multiplier = (pointer.x + pointer.y) / 2;
47
+ if (inverted)
48
+ multiplier *= -1;
49
+ }
50
+ else {
51
+ multiplier = handlerType === 'onMouseEnter' ? 1 : -1;
52
+ }
53
+ const baseValue = config[property];
54
+ if (baseValue === undefined)
55
+ return;
56
+ const interpolatedValue = getInterpolatedValue(baseValue, minValue, maxValue, multiplier, sensitivity);
57
+ switch (property) {
58
+ case 'intensity':
59
+ light.intensity = interpolatedValue;
60
+ break;
61
+ case 'color':
62
+ light.color = interpolatedValue instanceof Color ? interpolatedValue : new Color(interpolatedValue);
63
+ break;
64
+ case 'position':
65
+ if (Array.isArray(interpolatedValue) && interpolatedValue.length === 3)
66
+ light.position.set(interpolatedValue[0], interpolatedValue[1], interpolatedValue[2]);
67
+ break;
68
+ case 'angle':
69
+ if ('angle' in light)
70
+ light.angle = interpolatedValue;
71
+ break;
72
+ case 'penumbra':
73
+ if ('penumbra' in light)
74
+ light.penumbra = interpolatedValue;
75
+ break;
76
+ case 'distance':
77
+ if ('distance' in light)
78
+ light.distance = interpolatedValue;
79
+ break;
80
+ case 'decay':
81
+ if ('decay' in light)
82
+ light.decay = interpolatedValue;
83
+ break;
84
+ }
85
+ });
86
+ };
87
+ const handleLightEnter = useCallback((lightName) => {
88
+ hoveredLightRef.current = lightName;
89
+ const light = getLightFromRefs(lightRefs, lightName);
90
+ const config = lightConfigs.find((c) => c.name === lightName);
91
+ if (light && config?.handlers?.onMouseEnter?.enabled) {
92
+ applyHandlerToLight(light, config, config.handlers, { x: 0, y: 0 }, 'onMouseEnter');
93
+ }
94
+ }, [lightConfigs]);
95
+ const handleLightLeave = useCallback((lightName) => {
96
+ hoveredLightRef.current = null;
97
+ const light = getLightFromRefs(lightRefs, lightName);
98
+ const config = lightConfigs.find((c) => c.name === lightName);
99
+ if (light && config?.handlers?.onMouseLeave?.enabled) {
100
+ applyHandlerToLight(light, config, config.handlers, { x: 0, y: 0 }, 'onMouseLeave');
101
+ }
102
+ }, [lightConfigs]);
103
+ useFrame((state) => {
104
+ const pointer = state.pointer;
105
+ lightConfigs.forEach((config) => {
106
+ if (!config.handlers?.onMouseMove?.enabled)
107
+ return;
108
+ const light = getLightFromRefs(lightRefs, config.name);
109
+ if (!light)
110
+ return;
111
+ applyHandlerToLight(light, config, config.handlers, pointer, 'onMouseMove');
112
+ });
113
+ });
114
+ return { handleLightEnter, handleLightLeave };
115
+ };
116
+ export default useLightHandlers;