@3driseai/3drise-viewer 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AnimatedObject.d.ts +22 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -0
- package/dist/components/AnimatedObject.js +65 -0
- package/dist/components/Bubbles.d.ts +9 -0
- package/dist/components/Bubbles.d.ts.map +1 -0
- package/dist/components/Bubbles.js +105 -0
- package/dist/components/CameraController.d.ts +10 -0
- package/dist/components/CameraController.d.ts.map +1 -0
- package/dist/components/CameraController.js +158 -0
- package/dist/components/Clouds.d.ts +9 -0
- package/dist/components/Clouds.d.ts.map +1 -0
- package/dist/components/Clouds.js +278 -0
- package/dist/components/Corona.d.ts +18 -0
- package/dist/components/Corona.d.ts.map +1 -0
- package/dist/components/Corona.js +12 -0
- package/dist/components/CreatedObject.d.ts +14 -0
- package/dist/components/CreatedObject.d.ts.map +1 -0
- package/dist/components/CreatedObject.js +103 -0
- package/dist/components/CustomPrimitive.d.ts +12 -0
- package/dist/components/CustomPrimitive.d.ts.map +1 -0
- package/dist/components/CustomPrimitive.js +87 -0
- package/dist/components/Earth.d.ts +8 -0
- package/dist/components/Earth.d.ts.map +1 -0
- package/dist/components/Earth.js +38 -0
- package/dist/components/EffectsGenerator.d.ts +10 -0
- package/dist/components/EffectsGenerator.d.ts.map +1 -0
- package/dist/components/EffectsGenerator.js +71 -0
- package/dist/components/EffectsGroup.d.ts +8 -0
- package/dist/components/EffectsGroup.d.ts.map +1 -0
- package/dist/components/EffectsGroup.js +11 -0
- package/dist/components/EnvironmentManager.d.ts +9 -0
- package/dist/components/EnvironmentManager.d.ts.map +1 -0
- package/dist/components/EnvironmentManager.js +74 -0
- package/dist/components/EnvironmentObject.d.ts +8 -0
- package/dist/components/EnvironmentObject.d.ts.map +1 -0
- package/dist/components/EnvironmentObject.js +14 -0
- package/dist/components/Flares.d.ts +24 -0
- package/dist/components/Flares.d.ts.map +1 -0
- package/dist/components/Flares.js +134 -0
- package/dist/components/Frame.d.ts +23 -0
- package/dist/components/Frame.d.ts.map +1 -0
- package/dist/components/Frame.js +55 -0
- package/dist/components/FrameGeometry.d.ts +10 -0
- package/dist/components/FrameGeometry.d.ts.map +1 -0
- package/dist/components/FrameGeometry.js +17 -0
- package/dist/components/FrameImage.d.ts +2 -0
- package/dist/components/FrameImage.d.ts.map +1 -0
- package/dist/components/FrameImage.js +15 -0
- package/dist/components/Galaxy.d.ts +10 -0
- package/dist/components/Galaxy.d.ts.map +1 -0
- package/dist/components/Galaxy.js +29 -0
- package/dist/components/GalleryLayout.d.ts +12 -0
- package/dist/components/GalleryLayout.d.ts.map +1 -0
- package/dist/components/GalleryLayout.js +20 -0
- package/dist/components/GeometryShape.d.ts +54 -0
- package/dist/components/GeometryShape.d.ts.map +1 -0
- package/dist/components/GeometryShape.js +318 -0
- package/dist/components/Glyphs.d.ts +9 -0
- package/dist/components/Glyphs.d.ts.map +1 -0
- package/dist/components/Glyphs.js +58 -0
- package/dist/components/GridHelper.d.ts +23 -0
- package/dist/components/GridHelper.d.ts.map +1 -0
- package/dist/components/GridHelper.js +36 -0
- package/dist/components/GridsGenerator.d.ts +10 -0
- package/dist/components/GridsGenerator.d.ts.map +1 -0
- package/dist/components/GridsGenerator.js +14 -0
- package/dist/components/HdrPlaylistRenderer.d.ts +10 -0
- package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -0
- package/dist/components/HdrPlaylistRenderer.js +364 -0
- package/dist/components/ImageGeometry.d.ts +13 -0
- package/dist/components/ImageGeometry.d.ts.map +1 -0
- package/dist/components/ImageGeometry.js +62 -0
- package/dist/components/Lensflare.d.ts +12 -0
- package/dist/components/Lensflare.d.ts.map +1 -0
- package/dist/components/Lensflare.js +66 -0
- package/dist/components/Letter.d.ts +19 -0
- package/dist/components/Letter.d.ts.map +1 -0
- package/dist/components/Letter.js +83 -0
- package/dist/components/Letters.d.ts +16 -0
- package/dist/components/Letters.d.ts.map +1 -0
- package/dist/components/Letters.js +18 -0
- package/dist/components/LightObject.d.ts +8 -0
- package/dist/components/LightObject.d.ts.map +1 -0
- package/dist/components/LightObject.js +65 -0
- package/dist/components/LightsManager.d.ts +8 -0
- package/dist/components/LightsManager.d.ts.map +1 -0
- package/dist/components/LightsManager.js +104 -0
- package/dist/components/Lines.d.ts +9 -0
- package/dist/components/Lines.d.ts.map +1 -0
- package/dist/components/Lines.js +19 -0
- package/dist/components/LoadingIndicator.d.ts +10 -0
- package/dist/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/components/LoadingIndicator.js +6 -0
- package/dist/components/MaterialLibrary.d.ts +9 -0
- package/dist/components/MaterialLibrary.d.ts.map +1 -0
- package/dist/components/MaterialLibrary.js +57 -0
- package/dist/components/Moon.d.ts +13 -0
- package/dist/components/Moon.d.ts.map +1 -0
- package/dist/components/Moon.js +66 -0
- package/dist/components/MyGrid.d.ts +15 -0
- package/dist/components/MyGrid.d.ts.map +1 -0
- package/dist/components/MyGrid.js +72 -0
- package/dist/components/ObjectNode.d.ts +13 -0
- package/dist/components/ObjectNode.d.ts.map +1 -0
- package/dist/components/ObjectNode.js +139 -0
- package/dist/components/ObjectNodeApi.d.ts +13 -0
- package/dist/components/ObjectNodeApi.d.ts.map +1 -0
- package/dist/components/ObjectNodeApi.js +18 -0
- package/dist/components/ObjectsRenderer.d.ts +15 -0
- package/dist/components/ObjectsRenderer.d.ts.map +1 -0
- package/dist/components/ObjectsRenderer.js +40 -0
- package/dist/components/ObjectsRendererApi.d.ts +31 -0
- package/dist/components/ObjectsRendererApi.d.ts.map +1 -0
- package/dist/components/ObjectsRendererApi.js +76 -0
- package/dist/components/Ocean.d.ts +8 -0
- package/dist/components/Ocean.d.ts.map +1 -0
- package/dist/components/Ocean.js +169 -0
- package/dist/components/Outline.d.ts +21 -0
- package/dist/components/Outline.d.ts.map +1 -0
- package/dist/components/Outline.js +14 -0
- package/dist/components/ParticlesR3f.d.ts +11 -0
- package/dist/components/ParticlesR3f.d.ts.map +1 -0
- package/dist/components/ParticlesR3f.js +110 -0
- package/dist/components/Path.d.ts +13 -0
- package/dist/components/Path.d.ts.map +1 -0
- package/dist/components/Path.js +41 -0
- package/dist/components/PathGeometry.d.ts +11 -0
- package/dist/components/PathGeometry.d.ts.map +1 -0
- package/dist/components/PathGeometry.js +109 -0
- package/dist/components/PathRenderer.d.ts +12 -0
- package/dist/components/PathRenderer.d.ts.map +1 -0
- package/dist/components/PathRenderer.js +36 -0
- package/dist/components/Planet.d.ts +16 -0
- package/dist/components/Planet.d.ts.map +1 -0
- package/dist/components/Planet.js +60 -0
- package/dist/components/PointCloud.d.ts +10 -0
- package/dist/components/PointCloud.d.ts.map +1 -0
- package/dist/components/PointCloud.js +113 -0
- package/dist/components/ProductionScene.d.ts +5 -0
- package/dist/components/ProductionScene.d.ts.map +1 -0
- package/dist/components/ProductionScene.js +7 -0
- package/dist/components/ProjectLoader.d.ts +16 -0
- package/dist/components/ProjectLoader.d.ts.map +1 -0
- package/dist/components/ProjectLoader.js +85 -0
- package/dist/components/Rain.d.ts +8 -0
- package/dist/components/Rain.d.ts.map +1 -0
- package/dist/components/Rain.js +259 -0
- package/dist/components/RiseLogo.d.ts +19 -0
- package/dist/components/RiseLogo.d.ts.map +1 -0
- package/dist/components/RiseLogo.js +75 -0
- package/dist/components/SceneBuilder.d.ts +5 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -0
- package/dist/components/SceneBuilder.js +133 -0
- package/dist/components/SceneFog.d.ts +8 -0
- package/dist/components/SceneFog.d.ts.map +1 -0
- package/dist/components/SceneFog.js +19 -0
- package/dist/components/Shape.d.ts +5 -0
- package/dist/components/Shape.d.ts.map +1 -0
- package/dist/components/Shape.js +11 -0
- package/dist/components/ShootingStar.d.ts +16 -0
- package/dist/components/ShootingStar.d.ts.map +1 -0
- package/dist/components/ShootingStar.js +92 -0
- package/dist/components/ShootingStars.d.ts +8 -0
- package/dist/components/ShootingStars.d.ts.map +1 -0
- package/dist/components/ShootingStars.js +41 -0
- package/dist/components/SkyController.d.ts +10 -0
- package/dist/components/SkyController.d.ts.map +1 -0
- package/dist/components/SkyController.js +208 -0
- package/dist/components/SkyMesh.d.ts +10 -0
- package/dist/components/SkyMesh.d.ts.map +1 -0
- package/dist/components/SkyMesh.js +36 -0
- package/dist/components/SkySystem.d.ts +32 -0
- package/dist/components/SkySystem.d.ts.map +1 -0
- package/dist/components/SkySystem.js +46 -0
- package/dist/components/Skybox.d.ts +12 -0
- package/dist/components/Skybox.d.ts.map +1 -0
- package/dist/components/Skybox.js +92 -0
- package/dist/components/SolarSystem.d.ts +8 -0
- package/dist/components/SolarSystem.d.ts.map +1 -0
- package/dist/components/SolarSystem.js +77 -0
- package/dist/components/SparklesBurst.d.ts +9 -0
- package/dist/components/SparklesBurst.d.ts.map +1 -0
- package/dist/components/SparklesBurst.js +62 -0
- package/dist/components/Stars.d.ts +15 -0
- package/dist/components/Stars.d.ts.map +1 -0
- package/dist/components/Stars.js +250 -0
- package/dist/components/Sun.d.ts +15 -0
- package/dist/components/Sun.d.ts.map +1 -0
- package/dist/components/Sun.js +7 -0
- package/dist/components/SunCore.d.ts +18 -0
- package/dist/components/SunCore.d.ts.map +1 -0
- package/dist/components/SunCore.js +14 -0
- package/dist/components/SunLight.d.ts +15 -0
- package/dist/components/SunLight.d.ts.map +1 -0
- package/dist/components/SunLight.js +57 -0
- package/dist/components/Text2D.d.ts +9 -0
- package/dist/components/Text2D.d.ts.map +1 -0
- package/dist/components/Text2D.js +56 -0
- package/dist/components/Text3D.d.ts +10 -0
- package/dist/components/Text3D.d.ts.map +1 -0
- package/dist/components/Text3D.js +8 -0
- package/dist/components/VolumePoints.d.ts +19 -0
- package/dist/components/VolumePoints.d.ts.map +1 -0
- package/dist/components/VolumePoints.js +8 -0
- package/dist/components/cursor/AuraCursor.d.ts +6 -0
- package/dist/components/cursor/AuraCursor.d.ts.map +1 -0
- package/dist/components/cursor/AuraCursor.js +30 -0
- package/dist/components/cursor/AuroraCursor.d.ts +6 -0
- package/dist/components/cursor/AuroraCursor.d.ts.map +1 -0
- package/dist/components/cursor/AuroraCursor.js +207 -0
- package/dist/components/cursor/BubblesCursor.d.ts +6 -0
- package/dist/components/cursor/BubblesCursor.d.ts.map +1 -0
- package/dist/components/cursor/BubblesCursor.js +184 -0
- package/dist/components/cursor/CometCursor.d.ts +6 -0
- package/dist/components/cursor/CometCursor.d.ts.map +1 -0
- package/dist/components/cursor/CometCursor.js +191 -0
- package/dist/components/cursor/CrosshairCursor.d.ts +6 -0
- package/dist/components/cursor/CrosshairCursor.d.ts.map +1 -0
- package/dist/components/cursor/CrosshairCursor.js +142 -0
- package/dist/components/cursor/CursorActions.d.ts +8 -0
- package/dist/components/cursor/CursorActions.d.ts.map +1 -0
- package/dist/components/cursor/CursorActions.js +124 -0
- package/dist/components/cursor/CursorController.d.ts +10 -0
- package/dist/components/cursor/CursorController.d.ts.map +1 -0
- package/dist/components/cursor/CursorController.js +5 -0
- package/dist/components/cursor/CursorEffects.d.ts +16 -0
- package/dist/components/cursor/CursorEffects.d.ts.map +1 -0
- package/dist/components/cursor/CursorEffects.js +110 -0
- package/dist/components/cursor/FerrofluidCursor.d.ts +6 -0
- package/dist/components/cursor/FerrofluidCursor.d.ts.map +1 -0
- package/dist/components/cursor/FerrofluidCursor.js +102 -0
- package/dist/components/cursor/GlyphRingCursor.d.ts +6 -0
- package/dist/components/cursor/GlyphRingCursor.d.ts.map +1 -0
- package/dist/components/cursor/GlyphRingCursor.js +123 -0
- package/dist/components/cursor/LightningCursor.d.ts +6 -0
- package/dist/components/cursor/LightningCursor.d.ts.map +1 -0
- package/dist/components/cursor/LightningCursor.js +28 -0
- package/dist/components/cursor/LiquidMetalCursor.d.ts +6 -0
- package/dist/components/cursor/LiquidMetalCursor.d.ts.map +1 -0
- package/dist/components/cursor/LiquidMetalCursor.js +61 -0
- package/dist/components/cursor/OrbCursor.d.ts +6 -0
- package/dist/components/cursor/OrbCursor.d.ts.map +1 -0
- package/dist/components/cursor/OrbCursor.js +32 -0
- package/dist/components/cursor/PlasmaWhipCursor.d.ts +6 -0
- package/dist/components/cursor/PlasmaWhipCursor.d.ts.map +1 -0
- package/dist/components/cursor/PlasmaWhipCursor.js +134 -0
- package/dist/components/cursor/SparklesCursor.d.ts +6 -0
- package/dist/components/cursor/SparklesCursor.d.ts.map +1 -0
- package/dist/components/cursor/SparklesCursor.js +151 -0
- package/dist/components/cursor/TeslaCursor.d.ts +6 -0
- package/dist/components/cursor/TeslaCursor.d.ts.map +1 -0
- package/dist/components/cursor/TeslaCursor.js +223 -0
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/BoltFlashAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/BoltFlashAction.js +62 -0
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/GlyphInscriptionAction.js +114 -0
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/ImplosionAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/ImplosionAction.js +93 -0
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/PhaseShiftAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/PhaseShiftAction.js +71 -0
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/PlasmaBombAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/PlasmaBombAction.js +98 -0
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/RealityTearAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/RealityTearAction.js +92 -0
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/ShockwaveAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/ShockwaveAction.js +55 -0
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/SparklesBurstAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/SparklesBurstAction.js +99 -0
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts +11 -0
- package/dist/components/cursor/clickActions/VoronoiFractureAction.d.ts.map +1 -0
- package/dist/components/cursor/clickActions/VoronoiFractureAction.js +149 -0
- package/dist/components/effects/AuraEffect.d.ts +10 -0
- package/dist/components/effects/AuraEffect.d.ts.map +1 -0
- package/dist/components/effects/AuraEffect.js +127 -0
- package/dist/components/effects/AuroraEffect.d.ts +10 -0
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -0
- package/dist/components/effects/AuroraEffect.js +112 -0
- package/dist/components/effects/BlackHoleEffect.d.ts +10 -0
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -0
- package/dist/components/effects/BlackHoleEffect.js +193 -0
- package/dist/components/effects/ConstellationEffect.d.ts +10 -0
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -0
- package/dist/components/effects/ConstellationEffect.js +189 -0
- package/dist/components/effects/DataStreamEffect.d.ts +10 -0
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -0
- package/dist/components/effects/DataStreamEffect.js +138 -0
- package/dist/components/effects/DnaHelixEffect.d.ts +10 -0
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -0
- package/dist/components/effects/DnaHelixEffect.js +311 -0
- package/dist/components/effects/Fire.d.ts +20 -0
- package/dist/components/effects/Fire.d.ts.map +1 -0
- package/dist/components/effects/Fire.js +208 -0
- package/dist/components/effects/FireEffect.d.ts +10 -0
- package/dist/components/effects/FireEffect.d.ts.map +1 -0
- package/dist/components/effects/FireEffect.js +194 -0
- package/dist/components/effects/ForcefieldEffect.d.ts +10 -0
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -0
- package/dist/components/effects/ForcefieldEffect.js +132 -0
- package/dist/components/effects/HologramEffect.d.ts +10 -0
- package/dist/components/effects/HologramEffect.d.ts.map +1 -0
- package/dist/components/effects/HologramEffect.js +143 -0
- package/dist/components/effects/IceCrystalsEffect.d.ts +10 -0
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -0
- package/dist/components/effects/IceCrystalsEffect.js +190 -0
- package/dist/components/effects/LightningEffect.d.ts +10 -0
- package/dist/components/effects/LightningEffect.d.ts.map +1 -0
- package/dist/components/effects/LightningEffect.js +240 -0
- package/dist/components/effects/MoleculesEffect.d.ts +10 -0
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -0
- package/dist/components/effects/MoleculesEffect.js +173 -0
- package/dist/components/effects/NeuralNetworkEffect.d.ts +10 -0
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -0
- package/dist/components/effects/NeuralNetworkEffect.js +188 -0
- package/dist/components/effects/OrbEffect.d.ts +10 -0
- package/dist/components/effects/OrbEffect.d.ts.map +1 -0
- package/dist/components/effects/OrbEffect.js +291 -0
- package/dist/components/effects/PortalEffect.d.ts +10 -0
- package/dist/components/effects/PortalEffect.d.ts.map +1 -0
- package/dist/components/effects/PortalEffect.js +191 -0
- package/dist/components/effects/ShockwaveEffect.d.ts +10 -0
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -0
- package/dist/components/effects/ShockwaveEffect.js +160 -0
- package/dist/components/effects/SmokePlumeEffect.d.ts +10 -0
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -0
- package/dist/components/effects/SmokePlumeEffect.js +141 -0
- package/dist/components/effects/SmokeRibbon.d.ts +13 -0
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -0
- package/dist/components/effects/SmokeRibbon.js +69 -0
- package/dist/components/effects/SmokeRingEffect.d.ts +10 -0
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -0
- package/dist/components/effects/SmokeRingEffect.js +158 -0
- package/dist/components/effects/VolumetricFogEffect.d.ts +10 -0
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -0
- package/dist/components/effects/VolumetricFogEffect.js +111 -0
- package/dist/components/extractOutline.d.ts +18 -0
- package/dist/components/extractOutline.d.ts.map +1 -0
- package/dist/components/extractOutline.js +47 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/use3driseShader.d.ts +17 -0
- package/dist/hooks/use3driseShader.d.ts.map +1 -0
- package/dist/hooks/use3driseShader.js +100 -0
- package/dist/hooks/useAnimationEvents.d.ts +10 -0
- package/dist/hooks/useAnimationEvents.d.ts.map +1 -0
- package/dist/hooks/useAnimationEvents.js +49 -0
- package/dist/hooks/useCameraAnimation.d.ts +35 -0
- package/dist/hooks/useCameraAnimation.d.ts.map +1 -0
- package/dist/hooks/useCameraAnimation.js +277 -0
- package/dist/hooks/useContinuousEffects.d.ts +15 -0
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -0
- package/dist/hooks/useContinuousEffects.js +177 -0
- package/dist/hooks/useCubeCamera.d.ts +18 -0
- package/dist/hooks/useCubeCamera.d.ts.map +1 -0
- package/dist/hooks/useCubeCamera.js +73 -0
- package/dist/hooks/useEnvironmentEffects.d.ts +12 -0
- package/dist/hooks/useEnvironmentEffects.d.ts.map +1 -0
- package/dist/hooks/useEnvironmentEffects.js +22 -0
- package/dist/hooks/useFrameAnimations.d.ts +24 -0
- package/dist/hooks/useFrameAnimations.d.ts.map +1 -0
- package/dist/hooks/useFrameAnimations.js +217 -0
- package/dist/hooks/useFrameEffects.d.ts +6 -0
- package/dist/hooks/useFrameEffects.d.ts.map +1 -0
- package/dist/hooks/useFrameEffects.js +19 -0
- package/dist/hooks/useGsapAnimation.d.ts +122 -0
- package/dist/hooks/useGsapAnimation.d.ts.map +1 -0
- package/dist/hooks/useGsapAnimation.js +316 -0
- package/dist/hooks/useInteraction.d.ts +12 -0
- package/dist/hooks/useInteraction.d.ts.map +1 -0
- package/dist/hooks/useInteraction.js +273 -0
- package/dist/hooks/useInteractionEffects.d.ts +11 -0
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -0
- package/dist/hooks/useInteractionEffects.js +74 -0
- package/dist/hooks/useKey.d.ts +26 -0
- package/dist/hooks/useKey.d.ts.map +1 -0
- package/dist/hooks/useKey.js +73 -0
- package/dist/hooks/useLightAnimation.d.ts +10 -0
- package/dist/hooks/useLightAnimation.d.ts.map +1 -0
- package/dist/hooks/useLightAnimation.js +34 -0
- package/dist/hooks/useLightHandlers.d.ts +14 -0
- package/dist/hooks/useLightHandlers.d.ts.map +1 -0
- package/dist/hooks/useLightHandlers.js +116 -0
- package/dist/hooks/useLightMouseMove.d.ts +11 -0
- package/dist/hooks/useLightMouseMove.d.ts.map +1 -0
- package/dist/hooks/useLightMouseMove.js +27 -0
- package/dist/hooks/useLightShadow.d.ts +6 -0
- package/dist/hooks/useLightShadow.d.ts.map +1 -0
- package/dist/hooks/useLightShadow.js +63 -0
- package/dist/hooks/useMaterialApplication.d.ts +4 -0
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -0
- package/dist/hooks/useMaterialApplication.js +157 -0
- package/dist/hooks/useMaterialOptions.d.ts +14 -0
- package/dist/hooks/useMaterialOptions.d.ts.map +1 -0
- package/dist/hooks/useMaterialOptions.js +118 -0
- package/dist/hooks/useMaterialUniforms.d.ts +18 -0
- package/dist/hooks/useMaterialUniforms.d.ts.map +1 -0
- package/dist/hooks/useMaterialUniforms.js +96 -0
- package/dist/hooks/useMeshController.d.ts +3 -0
- package/dist/hooks/useMeshController.d.ts.map +1 -0
- package/dist/hooks/useMeshController.js +168 -0
- package/dist/hooks/useMouseHandlers.d.ts +8 -0
- package/dist/hooks/useMouseHandlers.d.ts.map +1 -0
- package/dist/hooks/useMouseHandlers.js +47 -0
- package/dist/hooks/useNumericAnimation.d.ts +5 -0
- package/dist/hooks/useNumericAnimation.d.ts.map +1 -0
- package/dist/hooks/useNumericAnimation.js +42 -0
- package/dist/hooks/useObjectAnimation.d.ts +13 -0
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -0
- package/dist/hooks/useObjectAnimation.js +35 -0
- package/dist/hooks/useObjectEdges.d.ts +3 -0
- package/dist/hooks/useObjectEdges.d.ts.map +1 -0
- package/dist/hooks/useObjectEdges.js +199 -0
- package/dist/hooks/useObjectEffects.d.ts +23 -0
- package/dist/hooks/useObjectEffects.d.ts.map +1 -0
- package/dist/hooks/useObjectEffects.js +162 -0
- package/dist/hooks/useOrbitControls.d.ts +7 -0
- package/dist/hooks/useOrbitControls.d.ts.map +1 -0
- package/dist/hooks/useOrbitControls.js +9 -0
- package/dist/hooks/useOutline.d.ts +9 -0
- package/dist/hooks/useOutline.d.ts.map +1 -0
- package/dist/hooks/useOutline.js +14 -0
- package/dist/hooks/useParticlePositions.d.ts +19 -0
- package/dist/hooks/useParticlePositions.d.ts.map +1 -0
- package/dist/hooks/useParticlePositions.js +56 -0
- package/dist/hooks/useParticlesColors.d.ts +14 -0
- package/dist/hooks/useParticlesColors.d.ts.map +1 -0
- package/dist/hooks/useParticlesColors.js +27 -0
- package/dist/hooks/useParticlesTextures.d.ts +10 -0
- package/dist/hooks/useParticlesTextures.d.ts.map +1 -0
- package/dist/hooks/useParticlesTextures.js +23 -0
- package/dist/hooks/usePathAnimation.d.ts +26 -0
- package/dist/hooks/usePathAnimation.d.ts.map +1 -0
- package/dist/hooks/usePathAnimation.js +130 -0
- package/dist/hooks/useSequenceAnimation.d.ts +14 -0
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -0
- package/dist/hooks/useSequenceAnimation.js +260 -0
- package/dist/hooks/useShadowApplication.d.ts +3 -0
- package/dist/hooks/useShadowApplication.d.ts.map +1 -0
- package/dist/hooks/useShadowApplication.js +31 -0
- package/dist/hooks/useShapeGeometry.d.ts +8 -0
- package/dist/hooks/useShapeGeometry.d.ts.map +1 -0
- package/dist/hooks/useShapeGeometry.js +12 -0
- package/dist/hooks/useSkyAnimation.d.ts +13 -0
- package/dist/hooks/useSkyAnimation.d.ts.map +1 -0
- package/dist/hooks/useSkyAnimation.js +36 -0
- package/dist/hooks/useSkySystem.d.ts +25 -0
- package/dist/hooks/useSkySystem.d.ts.map +1 -0
- package/dist/hooks/useSkySystem.js +59 -0
- package/dist/hooks/useSkyUniforms.d.ts +18 -0
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -0
- package/dist/hooks/useSkyUniforms.js +71 -0
- package/dist/hooks/useTransformControls.d.ts +6 -0
- package/dist/hooks/useTransformControls.d.ts.map +1 -0
- package/dist/hooks/useTransformControls.js +111 -0
- package/dist/hooks/useVolumePoints.d.ts +9 -0
- package/dist/hooks/useVolumePoints.d.ts.map +1 -0
- package/dist/hooks/useVolumePoints.js +22 -0
- package/dist/hooks/useWaterEnvironment.d.ts +5 -0
- package/dist/hooks/useWaterEnvironment.d.ts.map +1 -0
- package/dist/hooks/useWaterEnvironment.js +27 -0
- package/dist/hooks/useWaterReflections.d.ts +18 -0
- package/dist/hooks/useWaterReflections.d.ts.map +1 -0
- package/dist/hooks/useWaterReflections.js +84 -0
- package/dist/index.d.ts +146 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/services/AnimationsManager.d.ts +33 -0
- package/dist/services/AnimationsManager.d.ts.map +1 -0
- package/dist/services/AnimationsManager.js +58 -0
- package/dist/services/FontManager.d.ts +32 -0
- package/dist/services/FontManager.d.ts.map +1 -0
- package/dist/services/FontManager.js +76 -0
- package/dist/services/TexturesManager.d.ts +17 -0
- package/dist/services/TexturesManager.d.ts.map +1 -0
- package/dist/services/TexturesManager.js +48 -0
- package/dist/shaders/RainMaterial.d.ts +34 -0
- package/dist/shaders/RainMaterial.d.ts.map +1 -0
- package/dist/shaders/RainMaterial.js +56 -0
- package/dist/shaders/ShaderEffectsMaterial.d.ts +228 -0
- package/dist/shaders/ShaderEffectsMaterial.d.ts.map +1 -0
- package/dist/shaders/ShaderEffectsMaterial.js +233 -0
- package/dist/shaders/ShootingStarMaterial.d.ts +14 -0
- package/dist/shaders/ShootingStarMaterial.d.ts.map +1 -0
- package/dist/shaders/ShootingStarMaterial.js +33 -0
- package/dist/shaders/SkyboxMaterial.d.ts +38 -0
- package/dist/shaders/SkyboxMaterial.d.ts.map +1 -0
- package/dist/shaders/SkyboxMaterial.js +57 -0
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts +2 -0
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts.map +1 -0
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.js +115 -0
- package/dist/utils/CameraSingleton.d.ts +43 -0
- package/dist/utils/CameraSingleton.d.ts.map +1 -0
- package/dist/utils/CameraSingleton.js +199 -0
- package/dist/utils/anchorUtils.d.ts +10 -0
- package/dist/utils/anchorUtils.d.ts.map +1 -0
- package/dist/utils/anchorUtils.js +13 -0
- package/dist/utils/cursorPicking.d.ts +8 -0
- package/dist/utils/cursorPicking.d.ts.map +1 -0
- package/dist/utils/cursorPicking.js +35 -0
- package/dist/utils/extractOutline.d.ts +18 -0
- package/dist/utils/extractOutline.d.ts.map +1 -0
- package/dist/utils/extractOutline.js +47 -0
- package/dist/utils/frameAnimations.d.ts +49 -0
- package/dist/utils/frameAnimations.d.ts.map +1 -0
- package/dist/utils/frameAnimations.js +213 -0
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts +5 -0
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts.map +1 -0
- package/dist/utils/handleGenerativeEffectsAnimations.js +268 -0
- package/dist/utils/hasHoverAnimation.d.ts +3 -0
- package/dist/utils/hasHoverAnimation.d.ts.map +1 -0
- package/dist/utils/hasHoverAnimation.js +15 -0
- package/dist/utils/materialUtils.d.ts +23 -0
- package/dist/utils/materialUtils.d.ts.map +1 -0
- package/dist/utils/materialUtils.js +81 -0
- package/dist/utils/particleAnimations.d.ts +3 -0
- package/dist/utils/particleAnimations.d.ts.map +1 -0
- package/dist/utils/particleAnimations.js +17 -0
- package/dist/utils/sampleVolume.d.ts +21 -0
- package/dist/utils/sampleVolume.d.ts.map +1 -0
- package/dist/utils/sampleVolume.js +44 -0
- package/dist/utils/sceneQuery.d.ts +9 -0
- package/dist/utils/sceneQuery.d.ts.map +1 -0
- package/dist/utils/sceneQuery.js +22 -0
- package/dist/utils/shaderUtils.d.ts +6 -0
- package/dist/utils/shaderUtils.d.ts.map +1 -0
- package/dist/utils/shaderUtils.js +151 -0
- package/dist/utils/shapes.d.ts +74 -0
- package/dist/utils/shapes.d.ts.map +1 -0
- package/dist/utils/shapes.js +443 -0
- package/dist/utils/textEffects.d.ts +31 -0
- package/dist/utils/textEffects.d.ts.map +1 -0
- package/dist/utils/textEffects.js +61 -0
- package/dist/utils/utils3d.d.ts +7 -0
- package/dist/utils/utils3d.d.ts.map +1 -0
- package/dist/utils/utils3d.js +34 -0
- package/package.json +44 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useInteraction.ts
|
|
3
|
+
*
|
|
4
|
+
* Hook for handling Interactions on scene objects.
|
|
5
|
+
* Provides executeInteraction function and utility functions for:
|
|
6
|
+
* - Resolving target objects
|
|
7
|
+
* - Executing operations
|
|
8
|
+
* - Triggering animations
|
|
9
|
+
*/
|
|
10
|
+
import { useCallback, useRef } from 'react';
|
|
11
|
+
import { AnimationsManager, texturesManager } from '@3driseai/3drise-core';
|
|
12
|
+
import useCameraAnimation from '../hooks/useCameraAnimation.js';
|
|
13
|
+
import { useFrameAnimations } from '../hooks/useFrameAnimations.js';
|
|
14
|
+
import { useObjectEffects } from '../hooks/useObjectEffects.js';
|
|
15
|
+
import { findById } from '../utils/sceneQuery.js';
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// TYPES
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// HOOK
|
|
21
|
+
// =============================================================================
|
|
22
|
+
export function useInteraction({
|
|
23
|
+
// mode = 'default',
|
|
24
|
+
cameraSettings, sequences, }) {
|
|
25
|
+
// Redux state
|
|
26
|
+
// Track currently animated object for toggle behavior
|
|
27
|
+
const currentAnimatedRef = useRef(null);
|
|
28
|
+
// Hooks
|
|
29
|
+
const { animateCamera } = useCameraAnimation({
|
|
30
|
+
autoAnimate: false,
|
|
31
|
+
defaultDuration: 1,
|
|
32
|
+
defaultEase: "power2.out"
|
|
33
|
+
});
|
|
34
|
+
const { moveToFront, zoomToFrame, restoreOriginalTransform, restoreCamera } = useFrameAnimations(cameraSettings);
|
|
35
|
+
const { vanishObject, restoreVanishedObject, animateGlowEffect, removeGlow, isVanished, isGlowing, glowingObjects, vanishedObjects, } = useObjectEffects();
|
|
36
|
+
// ===========================================================================
|
|
37
|
+
// UTILITY: Resolve Target Objects
|
|
38
|
+
// ===========================================================================
|
|
39
|
+
const resolveTargets = useCallback((interaction, currentRef) => {
|
|
40
|
+
const { targetIds, targetMode } = interaction;
|
|
41
|
+
// If no targetIds specified, return current object only
|
|
42
|
+
if (!targetIds || targetIds.length === 0) {
|
|
43
|
+
return [currentRef];
|
|
44
|
+
}
|
|
45
|
+
console.log('[useInteraction] resolveTargets:', { targetIds, targetMode });
|
|
46
|
+
const targetRefs = [];
|
|
47
|
+
// Add current object if mode is 'add'
|
|
48
|
+
if (targetMode === 'add') {
|
|
49
|
+
targetRefs.push(currentRef);
|
|
50
|
+
}
|
|
51
|
+
// Lookup targets from scene
|
|
52
|
+
targetIds.forEach(id => {
|
|
53
|
+
const obj = findById(id);
|
|
54
|
+
if (obj) {
|
|
55
|
+
targetRefs.push(obj);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.warn(`[useInteraction] Target not found: ${id}`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return targetRefs.length > 0 ? targetRefs : [currentRef];
|
|
62
|
+
}, []);
|
|
63
|
+
// ===========================================================================
|
|
64
|
+
// UTILITY: Trigger Animations
|
|
65
|
+
// ===========================================================================
|
|
66
|
+
const triggerAnimations = useCallback((animationIds) => {
|
|
67
|
+
if (!animationIds || animationIds.length === 0)
|
|
68
|
+
return;
|
|
69
|
+
console.log('[useInteraction] triggerAnimations:', animationIds);
|
|
70
|
+
console.log('Available sequences:', sequences.map(s => s.id));
|
|
71
|
+
animationIds.forEach(animationId => {
|
|
72
|
+
const sequence = sequences.find(s => s.id === animationId);
|
|
73
|
+
if (sequence) {
|
|
74
|
+
AnimationsManager.playSequence(sequence);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.warn(`[useInteraction] Sequence not found: ${animationId}`);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}, [sequences]);
|
|
81
|
+
// ===========================================================================
|
|
82
|
+
// UTILITY: Execute Single Operation
|
|
83
|
+
// ===========================================================================
|
|
84
|
+
const executeOperation = useCallback(async (operation, ref, createdObject, textureUrl) => {
|
|
85
|
+
if (!operation || operation === 'none')
|
|
86
|
+
return;
|
|
87
|
+
const defaultDuration = 1.0;
|
|
88
|
+
const defaultEase = "power2.out";
|
|
89
|
+
const defaultDistance = 2.0;
|
|
90
|
+
const isCurrentlySelected = currentAnimatedRef.current !== null;
|
|
91
|
+
const isSameObject = currentAnimatedRef.current?.uuid === ref.uuid;
|
|
92
|
+
console.log('[useInteraction] executeOperation:', operation);
|
|
93
|
+
switch (operation) {
|
|
94
|
+
case 'vanish': {
|
|
95
|
+
if (isVanished(ref.uuid)) {
|
|
96
|
+
restoreVanishedObject(ref, defaultDuration, defaultEase);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
vanishObject(ref, defaultDuration, defaultEase);
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case 'glow': {
|
|
104
|
+
if (isGlowing(ref.uuid)) {
|
|
105
|
+
removeGlow(ref);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
animateGlowEffect(ref);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 'focus': {
|
|
113
|
+
animateCamera({}, defaultDuration, defaultEase, createdObject.meshSettings.position);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case 'moveToFront': {
|
|
117
|
+
// Toggle: if clicking the same object, restore it
|
|
118
|
+
if (isCurrentlySelected && isSameObject) {
|
|
119
|
+
restoreOriginalTransform(currentAnimatedRef.current, {
|
|
120
|
+
duration: defaultDuration,
|
|
121
|
+
ease: defaultEase
|
|
122
|
+
});
|
|
123
|
+
currentAnimatedRef.current = null;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
// Restore previous object if different
|
|
127
|
+
if (isCurrentlySelected && !isSameObject) {
|
|
128
|
+
restoreOriginalTransform(currentAnimatedRef.current, {
|
|
129
|
+
duration: defaultDuration,
|
|
130
|
+
ease: defaultEase
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// Apply new animation
|
|
134
|
+
moveToFront(ref, {
|
|
135
|
+
distance: defaultDistance,
|
|
136
|
+
scale: [6, 4],
|
|
137
|
+
duration: defaultDuration,
|
|
138
|
+
ease: defaultEase
|
|
139
|
+
});
|
|
140
|
+
currentAnimatedRef.current = ref;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 'zoom': {
|
|
144
|
+
// Toggle: if clicking the same object, restore camera
|
|
145
|
+
if (isCurrentlySelected && isSameObject) {
|
|
146
|
+
restoreCamera({ duration: defaultDuration, ease: defaultEase });
|
|
147
|
+
currentAnimatedRef.current = null;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// Restore previous camera if different object
|
|
151
|
+
if (isCurrentlySelected && !isSameObject) {
|
|
152
|
+
restoreCamera({ duration: defaultDuration, ease: defaultEase });
|
|
153
|
+
}
|
|
154
|
+
// Apply new zoom
|
|
155
|
+
zoomToFrame(ref, {
|
|
156
|
+
distance: defaultDistance,
|
|
157
|
+
duration: defaultDuration,
|
|
158
|
+
ease: defaultEase
|
|
159
|
+
});
|
|
160
|
+
currentAnimatedRef.current = ref;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case 'playAnimation':
|
|
164
|
+
// Handled by triggerAnimations
|
|
165
|
+
break;
|
|
166
|
+
case 'displayImage': {
|
|
167
|
+
if (!textureUrl)
|
|
168
|
+
break;
|
|
169
|
+
let applier;
|
|
170
|
+
let meshWithMap = null;
|
|
171
|
+
ref.traverse((child) => {
|
|
172
|
+
if (!applier && typeof child.userData?.applyTexture === 'function') {
|
|
173
|
+
applier = child.userData.applyTexture;
|
|
174
|
+
}
|
|
175
|
+
else if (!meshWithMap && child.material) {
|
|
176
|
+
meshWithMap = child;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
if (applier) {
|
|
180
|
+
applier(textureUrl);
|
|
181
|
+
}
|
|
182
|
+
else if (meshWithMap) {
|
|
183
|
+
const name = textureUrl.split('/').pop()?.split('.')[0] || `texture-${Date.now()}`;
|
|
184
|
+
try {
|
|
185
|
+
const loaded = await texturesManager.loadTexture(name, textureUrl, 'images');
|
|
186
|
+
const mat = meshWithMap.material;
|
|
187
|
+
mat.map = loaded;
|
|
188
|
+
mat.needsUpdate = true;
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
console.error('[useInteraction] Failed to load texture:', err);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case 'create':
|
|
197
|
+
case 'update':
|
|
198
|
+
case 'delete':
|
|
199
|
+
case 'toggle':
|
|
200
|
+
case 'loadProject':
|
|
201
|
+
console.log(`[useInteraction] ${operation} - not implemented for scene interactions`);
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
console.warn(`[useInteraction] Unknown operation: ${operation}`);
|
|
205
|
+
}
|
|
206
|
+
}, [
|
|
207
|
+
isVanished,
|
|
208
|
+
isGlowing,
|
|
209
|
+
vanishObject,
|
|
210
|
+
restoreVanishedObject,
|
|
211
|
+
animateGlowEffect,
|
|
212
|
+
removeGlow,
|
|
213
|
+
animateCamera,
|
|
214
|
+
moveToFront,
|
|
215
|
+
zoomToFrame,
|
|
216
|
+
restoreOriginalTransform,
|
|
217
|
+
restoreCamera,
|
|
218
|
+
]);
|
|
219
|
+
// ===========================================================================
|
|
220
|
+
// UTILITY: Execute Multiple Operations
|
|
221
|
+
// ===========================================================================
|
|
222
|
+
const executeOperations = useCallback((operations, ref, createdObject, textureUrl) => {
|
|
223
|
+
if (!operations || operations.length === 0)
|
|
224
|
+
return;
|
|
225
|
+
console.log('[useInteraction] executeOperations:', operations);
|
|
226
|
+
operations.forEach(operation => {
|
|
227
|
+
executeOperation(operation, ref, createdObject, textureUrl);
|
|
228
|
+
});
|
|
229
|
+
}, [executeOperation]);
|
|
230
|
+
// ===========================================================================
|
|
231
|
+
// MAIN: Execute Interaction
|
|
232
|
+
// ===========================================================================
|
|
233
|
+
const executeInteraction = useCallback((params) => {
|
|
234
|
+
const { interaction, ref, createdObject } = params;
|
|
235
|
+
if (!interaction.enabled)
|
|
236
|
+
return;
|
|
237
|
+
console.log('[useInteraction] executeInteraction:', {
|
|
238
|
+
mouseEvent: interaction.mouseEvent,
|
|
239
|
+
operations: interaction.operations,
|
|
240
|
+
targetIds: interaction.targetIds,
|
|
241
|
+
animationIds: interaction.animationIds
|
|
242
|
+
});
|
|
243
|
+
let textureUrl = undefined;
|
|
244
|
+
if (interaction.operations?.includes('displayImage')) {
|
|
245
|
+
console.log('Display Image interaction triggered:', {
|
|
246
|
+
ref,
|
|
247
|
+
});
|
|
248
|
+
textureUrl = ref.userData?.url;
|
|
249
|
+
console.log('Texture URL:', textureUrl);
|
|
250
|
+
}
|
|
251
|
+
// 1. Resolve target objects
|
|
252
|
+
const targets = resolveTargets(interaction, ref);
|
|
253
|
+
// 2. Execute operations on each target
|
|
254
|
+
targets.forEach(targetRef => {
|
|
255
|
+
// Find the createdObject for this target (if different from original)
|
|
256
|
+
// For now, use the original createdObject for position data
|
|
257
|
+
executeOperations(interaction.operations, targetRef, createdObject, textureUrl);
|
|
258
|
+
});
|
|
259
|
+
// 3. Trigger animations
|
|
260
|
+
triggerAnimations(interaction.animationIds);
|
|
261
|
+
}, [resolveTargets, executeOperations, triggerAnimations]);
|
|
262
|
+
// ===========================================================================
|
|
263
|
+
// RETURN
|
|
264
|
+
// ===========================================================================
|
|
265
|
+
return {
|
|
266
|
+
executeInteraction,
|
|
267
|
+
// Expose refs for context to share
|
|
268
|
+
currentAnimatedRef,
|
|
269
|
+
glowingObjects,
|
|
270
|
+
vanishedObjects,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
export default useInteraction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CreatedObjectSettings } from '@3driseai/3drise-core';
|
|
2
|
+
import { Object3D } from "three";
|
|
3
|
+
export interface UseInteractionEffectsOptions {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
animateMaterial?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface UseInteractionEffectsResult {
|
|
8
|
+
}
|
|
9
|
+
export declare const useMouseMove: (objectSettings: CreatedObjectSettings | null, options: UseInteractionEffectsOptions, object: Object3D) => UseInteractionEffectsResult;
|
|
10
|
+
export default useMouseMove;
|
|
11
|
+
//# sourceMappingURL=useInteractionEffects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInteractionEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useInteractionEffects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,WAAW,4BAA4B;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;CAC3C;AAqDD,eAAO,MAAM,YAAY,GAAI,gBAAgB,qBAAqB,GAAG,IAAI,EAAE,SAAS,4BAAiC,EAAE,QAAQ,QAAQ,KAAG,2BAoBzI,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useFrame } from "@react-three/fiber";
|
|
2
|
+
import { detectAnimatableDomain, handleEdgesMouseMove, handleMaterialMouseMove, handleTransformMouseMove, } from '@3driseai/3drise-core';
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// FLAT-SHAPE BACK COMPAT
|
|
5
|
+
// =============================================================================
|
|
6
|
+
//
|
|
7
|
+
// Older persisted projects store mouseMove as { enabled, properties: [...] }
|
|
8
|
+
// (a single flat array). The new shape is per-domain. This helper detects
|
|
9
|
+
// which shape we got and projects the flat array onto the per-domain shape so
|
|
10
|
+
// the rest of the hook can deal with one model only.
|
|
11
|
+
//
|
|
12
|
+
// Note: 'light' is intentionally not handled here — the light domain is
|
|
13
|
+
// driven by useLightMouseMove inside LightObject, not by this hook.
|
|
14
|
+
function splitFlatProperties(settings, properties) {
|
|
15
|
+
const out = { transform: [], material: [], edges: [] };
|
|
16
|
+
for (const p of properties) {
|
|
17
|
+
const domain = detectAnimatableDomain(settings, p.property);
|
|
18
|
+
if (domain === 'transform')
|
|
19
|
+
out.transform.push(p);
|
|
20
|
+
else if (domain === 'edges')
|
|
21
|
+
out.edges.push(p);
|
|
22
|
+
else if (domain === 'material')
|
|
23
|
+
out.material.push(p);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
function isPerDomainShape(mm) {
|
|
28
|
+
if (!mm)
|
|
29
|
+
return false;
|
|
30
|
+
return 'transform' in mm || 'material' in mm || 'edges' in mm || 'light' in mm;
|
|
31
|
+
}
|
|
32
|
+
function resolveDomains(settings) {
|
|
33
|
+
const mm = settings.mouseMove;
|
|
34
|
+
if (!mm)
|
|
35
|
+
return { enabled: false };
|
|
36
|
+
if (isPerDomainShape(mm)) {
|
|
37
|
+
return { transform: mm.transform, material: mm.material, edges: mm.edges, enabled: mm.enabled };
|
|
38
|
+
}
|
|
39
|
+
// Flat shape — project onto per-domain.
|
|
40
|
+
if (!mm.enabled || !mm.properties?.length)
|
|
41
|
+
return { enabled: mm.enabled };
|
|
42
|
+
const split = splitFlatProperties(settings, mm.properties);
|
|
43
|
+
return {
|
|
44
|
+
transform: { enabled: true, properties: split.transform },
|
|
45
|
+
material: { enabled: true, properties: split.material },
|
|
46
|
+
edges: { enabled: true, properties: split.edges },
|
|
47
|
+
enabled: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// =============================================================================
|
|
51
|
+
// useMouseMove
|
|
52
|
+
// =============================================================================
|
|
53
|
+
export const useMouseMove = (objectSettings, options = {}, object) => {
|
|
54
|
+
const { enabled = true, animateMaterial = true } = options;
|
|
55
|
+
useFrame((state) => {
|
|
56
|
+
if (!enabled || !object || !objectSettings)
|
|
57
|
+
return;
|
|
58
|
+
const domains = resolveDomains(objectSettings);
|
|
59
|
+
if (!domains.enabled)
|
|
60
|
+
return;
|
|
61
|
+
const pointer = state.pointer;
|
|
62
|
+
if (domains.transform?.enabled && domains.transform.properties?.length) {
|
|
63
|
+
handleTransformMouseMove({ object, meshSettings: objectSettings.meshSettings }, domains.transform.properties, pointer);
|
|
64
|
+
}
|
|
65
|
+
if (animateMaterial && domains.material?.enabled && domains.material.properties?.length) {
|
|
66
|
+
handleMaterialMouseMove({ object, materialSettings: objectSettings.materialSettings }, domains.material.properties, pointer);
|
|
67
|
+
}
|
|
68
|
+
if (domains.edges?.enabled && domains.edges.properties?.length) {
|
|
69
|
+
handleEdgesMouseMove({ object, edgesMaterialSettings: objectSettings.edgesSettings?.materialSettings }, domains.edges.properties, pointer);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return {};
|
|
73
|
+
};
|
|
74
|
+
export default useMouseMove;
|
|
@@ -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":"AACA,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAEjD,UAAU,aAAa;IACnB,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;CAC7B;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,aAAa,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,UAAS,aAAkB,KAAG,IAsB7F,CAAC;AACF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,iBAAiB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,gBAAe,MAAM,CAAC,MAAM,EAAE,UAAU,CAAM,EAAE,UAAS,aAAkB,KAAG,IAoCvJ,CAAC;AACF,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,10 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { AnimationOptions } from '@3driseai/3drise-core';
|
|
3
|
+
import type { Light } from "three";
|
|
4
|
+
export interface UseLightAnimationOptions {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
hovered?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const useLightAnimation: (lightRef: RefObject<Light | null>, animations: AnimationOptions[] | undefined, options?: UseLightAnimationOptions) => void;
|
|
9
|
+
export default useLightAnimation;
|
|
10
|
+
//# sourceMappingURL=useLightAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLightAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useLightAnimation.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACnC,MAAM,WAAW,wBAAwB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAGD,eAAO,MAAM,iBAAiB,GAAI,UAAU,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,YAAY,gBAAgB,EAAE,GAAG,SAAS,EAAE,UAAS,wBAA6B,KAAG,IAkBzJ,CAAC;AACF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// useLightAnimation — drives keyframe animations on a THREE.Light
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// Per-frame animator that reads an AnimationOptions[] array and applies
|
|
6
|
+
// interpolated values to a Light ref. Used by both per-object lights
|
|
7
|
+
// (LightObject) and scene-level lights (LightsManager: ambient + sun).
|
|
8
|
+
//
|
|
9
|
+
// No-op when animations is undefined / empty, or when the ref hasn't attached
|
|
10
|
+
// yet.
|
|
11
|
+
//
|
|
12
|
+
import { useEffect, useRef } from 'react';
|
|
13
|
+
import { useFrame } from '@react-three/fiber';
|
|
14
|
+
import { handleLightAnimations } from '@3driseai/3drise-core';
|
|
15
|
+
export const useLightAnimation = (lightRef, animations, options = {}) => {
|
|
16
|
+
const { enabled = true, hovered = false } = options;
|
|
17
|
+
const startValuesRef = useRef({});
|
|
18
|
+
// Reset cached start values whenever the animations array reference changes,
|
|
19
|
+
// so editing an animation in the UI re-samples the light's current value.
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
startValuesRef.current = {};
|
|
22
|
+
}, [animations]);
|
|
23
|
+
useFrame(() => {
|
|
24
|
+
if (!enabled)
|
|
25
|
+
return;
|
|
26
|
+
const light = lightRef.current;
|
|
27
|
+
if (!light)
|
|
28
|
+
return;
|
|
29
|
+
if (!animations || animations.length === 0)
|
|
30
|
+
return;
|
|
31
|
+
handleLightAnimations({ light, startValuesCache: startValuesRef.current }, animations, Date.now(), hovered);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export default useLightAnimation;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { DirectionalLight, SpotLight, PointLight } from 'three';
|
|
3
|
+
import type { BaseLightConfig, SpotLightConfig, PointLightConfig } from "@3driseai/3drise-core";
|
|
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":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChG,UAAU,cAAc;IACpB,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;CAC7D;AAMD,eAAO,MAAM,gBAAgB,GAAI,WAAW,cAAc,EAAE,cAAc,CAAC,eAAe,GAAG,eAAe,GAAG,gBAAgB,CAAC,EAAE,KAAG;IAC7H,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CA6GrD,CAAC;AACF,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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MouseMoveDomain } from '@3driseai/3drise-core';
|
|
2
|
+
import { type RefObject } from "react";
|
|
3
|
+
import type { Light } from "three";
|
|
4
|
+
export interface UseLightMouseMoveOptions {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
/** Optional base values (intensity/color/etc.) used for fallback resolution. */
|
|
7
|
+
lightConfig?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useLightMouseMove: (lightRef: RefObject<Light | null>, domain: MouseMoveDomain | undefined, options?: UseLightMouseMoveOptions) => void;
|
|
10
|
+
export default useLightMouseMove;
|
|
11
|
+
//# sourceMappingURL=useLightMouseMove.d.ts.map
|