@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,199 @@
|
|
|
1
|
+
import { PerspectiveCamera, OrthographicCamera, Vector3, Euler, Quaternion } from 'three';
|
|
2
|
+
class CameraSingleton {
|
|
3
|
+
static instance;
|
|
4
|
+
camera = null;
|
|
5
|
+
callbacks = new Set();
|
|
6
|
+
cameraMoveCallbacks = new Set();
|
|
7
|
+
lastPosition = new Vector3();
|
|
8
|
+
lastRotation = new Euler();
|
|
9
|
+
constructor() { }
|
|
10
|
+
static getInstance() {
|
|
11
|
+
if (!CameraSingleton.instance) {
|
|
12
|
+
CameraSingleton.instance = new CameraSingleton();
|
|
13
|
+
}
|
|
14
|
+
return CameraSingleton.instance;
|
|
15
|
+
}
|
|
16
|
+
animateCameraPosition(position) {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
if (!this.camera) {
|
|
19
|
+
resolve();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const targetPosition = new Vector3(...position);
|
|
23
|
+
const duration = 1;
|
|
24
|
+
const startPosition = this.camera.position.clone();
|
|
25
|
+
const startTime = performance.now();
|
|
26
|
+
const animate = () => {
|
|
27
|
+
const elapsed = (performance.now() - startTime) / 1000;
|
|
28
|
+
const t = Math.min(elapsed / duration, 1);
|
|
29
|
+
this.camera.position.lerpVectors(startPosition, targetPosition, t);
|
|
30
|
+
this.notifyCallbacks();
|
|
31
|
+
if (t < 1)
|
|
32
|
+
requestAnimationFrame(animate);
|
|
33
|
+
else
|
|
34
|
+
resolve();
|
|
35
|
+
};
|
|
36
|
+
animate();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
setCamera(camera) {
|
|
40
|
+
this.camera = camera;
|
|
41
|
+
this.lastPosition.copy(camera.position);
|
|
42
|
+
this.lastRotation.copy(camera.rotation);
|
|
43
|
+
this.notifyCallbacks();
|
|
44
|
+
}
|
|
45
|
+
getCamera() { return this.camera; }
|
|
46
|
+
getPosition() { return this.camera ? this.camera.position.clone() : new Vector3(); }
|
|
47
|
+
getRotation() { return this.camera ? this.camera.rotation.clone() : new Euler(); }
|
|
48
|
+
isSynced(position, orientation) {
|
|
49
|
+
if (!this.camera)
|
|
50
|
+
return true;
|
|
51
|
+
const camPos = this.camera.position;
|
|
52
|
+
const camRot = this.camera.rotation;
|
|
53
|
+
const posMatch = Math.abs(position[0] - camPos.x) < 0.001 &&
|
|
54
|
+
Math.abs(position[1] - camPos.y) < 0.001 &&
|
|
55
|
+
Math.abs(position[2] - camPos.z) < 0.001;
|
|
56
|
+
let rotMatch = false;
|
|
57
|
+
if (orientation.length === 3) {
|
|
58
|
+
rotMatch =
|
|
59
|
+
Math.abs(orientation[0] - camRot.x) < 0.001 &&
|
|
60
|
+
Math.abs(orientation[1] - camRot.y) < 0.001 &&
|
|
61
|
+
Math.abs(orientation[2] - camRot.z) < 0.001;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const camQuat = new Quaternion().setFromEuler(camRot);
|
|
65
|
+
rotMatch =
|
|
66
|
+
Math.abs(orientation[0] - camQuat.x) < 0.001 &&
|
|
67
|
+
Math.abs(orientation[1] - camQuat.y) < 0.001 &&
|
|
68
|
+
Math.abs(orientation[2] - camQuat.z) < 0.001 &&
|
|
69
|
+
Math.abs(orientation[3] - camQuat.w) < 0.001;
|
|
70
|
+
}
|
|
71
|
+
return posMatch && rotMatch;
|
|
72
|
+
}
|
|
73
|
+
getWorldDirection() {
|
|
74
|
+
const direction = new Vector3();
|
|
75
|
+
return this.camera ? this.camera.getWorldDirection(direction) : direction;
|
|
76
|
+
}
|
|
77
|
+
getFOV() { return this.camera ? this.camera.fov : 75; }
|
|
78
|
+
subscribe(callback) {
|
|
79
|
+
this.callbacks.add(callback);
|
|
80
|
+
return () => this.callbacks.delete(callback);
|
|
81
|
+
}
|
|
82
|
+
notifyCallbacks() {
|
|
83
|
+
this.callbacks.forEach((cb) => cb());
|
|
84
|
+
}
|
|
85
|
+
isAvailable() { return this.camera !== null; }
|
|
86
|
+
getDistanceToTarget(target) {
|
|
87
|
+
return this.camera ? this.camera.position.distanceTo(target) : 0;
|
|
88
|
+
}
|
|
89
|
+
lookAt(target) {
|
|
90
|
+
if (this.camera) {
|
|
91
|
+
this.camera.lookAt(target);
|
|
92
|
+
this.notifyCallbacks();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
calculateVisibleSize(targetDepth, cam) {
|
|
96
|
+
const camera = cam || this.camera;
|
|
97
|
+
if (!camera)
|
|
98
|
+
return { width: 0, height: 0 };
|
|
99
|
+
if (camera instanceof PerspectiveCamera) {
|
|
100
|
+
const distance = targetDepth === undefined ? camera.near : Math.abs(targetDepth - camera.position.z);
|
|
101
|
+
const vFov = (camera.fov * Math.PI) / 180;
|
|
102
|
+
const height = 2 * Math.tan(vFov / 2) * distance;
|
|
103
|
+
return { width: height * camera.aspect, height };
|
|
104
|
+
}
|
|
105
|
+
else if (camera instanceof OrthographicCamera) {
|
|
106
|
+
return { width: Math.abs(camera.right - camera.left), height: Math.abs(camera.top - camera.bottom) };
|
|
107
|
+
}
|
|
108
|
+
return { width: 0, height: 0 };
|
|
109
|
+
}
|
|
110
|
+
getCurrentViewportBounds(cam) {
|
|
111
|
+
const camera = cam || this.camera;
|
|
112
|
+
const empty = new Vector3();
|
|
113
|
+
if (!camera) {
|
|
114
|
+
return {
|
|
115
|
+
topLeft: empty.clone(),
|
|
116
|
+
topRight: empty.clone(),
|
|
117
|
+
bottomLeft: empty.clone(),
|
|
118
|
+
bottomRight: empty.clone(),
|
|
119
|
+
center: empty.clone()
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
camera.updateMatrixWorld();
|
|
123
|
+
// NDC z=-1 is the near clipping plane for both perspective and orthographic cameras.
|
|
124
|
+
const topLeft = new Vector3(-1, 1, -1).unproject(camera);
|
|
125
|
+
const topRight = new Vector3(1, 1, -1).unproject(camera);
|
|
126
|
+
const bottomLeft = new Vector3(-1, -1, -1).unproject(camera);
|
|
127
|
+
const bottomRight = new Vector3(1, -1, -1).unproject(camera);
|
|
128
|
+
const center = new Vector3(0, 0, -1).unproject(camera);
|
|
129
|
+
return { topLeft, topRight, bottomLeft, bottomRight, center };
|
|
130
|
+
}
|
|
131
|
+
getAnchorPosition(anchor, targetDepth = 0, offset, padding = 0) {
|
|
132
|
+
if (!this.camera)
|
|
133
|
+
return new Vector3();
|
|
134
|
+
const { width, height } = this.calculateVisibleSize(targetDepth);
|
|
135
|
+
const halfWidth = width / 2;
|
|
136
|
+
const halfHeight = height / 2;
|
|
137
|
+
let localX = 0;
|
|
138
|
+
let localY = 0;
|
|
139
|
+
switch (anchor) {
|
|
140
|
+
case 'top-left':
|
|
141
|
+
case 'center-left':
|
|
142
|
+
case 'bottom-left':
|
|
143
|
+
localX = -halfWidth + padding;
|
|
144
|
+
break;
|
|
145
|
+
case 'top-right':
|
|
146
|
+
case 'center-right':
|
|
147
|
+
case 'bottom-right':
|
|
148
|
+
localX = halfWidth - padding;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
switch (anchor) {
|
|
152
|
+
case 'top-left':
|
|
153
|
+
case 'top-center':
|
|
154
|
+
case 'top-right':
|
|
155
|
+
localY = halfHeight - padding;
|
|
156
|
+
break;
|
|
157
|
+
case 'bottom-left':
|
|
158
|
+
case 'bottom-center':
|
|
159
|
+
case 'bottom-right':
|
|
160
|
+
localY = -halfHeight + padding;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
const localZ = -(Math.abs(targetDepth - this.camera.position.z));
|
|
164
|
+
const localPosition = new Vector3(localX, localY, localZ);
|
|
165
|
+
if (offset) {
|
|
166
|
+
if (offset.x !== undefined)
|
|
167
|
+
localPosition.x += offset.x;
|
|
168
|
+
if (offset.y !== undefined)
|
|
169
|
+
localPosition.y += offset.y;
|
|
170
|
+
if (offset.z !== undefined)
|
|
171
|
+
localPosition.z += offset.z;
|
|
172
|
+
}
|
|
173
|
+
this.camera.updateMatrixWorld();
|
|
174
|
+
return localPosition.applyMatrix4(this.camera.matrixWorld);
|
|
175
|
+
}
|
|
176
|
+
onCameraMove(callback) {
|
|
177
|
+
this.cameraMoveCallbacks.add(callback);
|
|
178
|
+
return () => this.cameraMoveCallbacks.delete(callback);
|
|
179
|
+
}
|
|
180
|
+
checkCameraMovement(epsilon = 0.001) {
|
|
181
|
+
if (!this.camera)
|
|
182
|
+
return false;
|
|
183
|
+
const positionChanged = Math.abs(this.lastPosition.x - this.camera.position.x) > epsilon ||
|
|
184
|
+
Math.abs(this.lastPosition.y - this.camera.position.y) > epsilon ||
|
|
185
|
+
Math.abs(this.lastPosition.z - this.camera.position.z) > epsilon;
|
|
186
|
+
const rotationChanged = Math.abs(this.lastRotation.x - this.camera.rotation.x) > epsilon ||
|
|
187
|
+
Math.abs(this.lastRotation.y - this.camera.rotation.y) > epsilon ||
|
|
188
|
+
Math.abs(this.lastRotation.z - this.camera.rotation.z) > epsilon;
|
|
189
|
+
if (positionChanged || rotationChanged) {
|
|
190
|
+
this.lastPosition.copy(this.camera.position);
|
|
191
|
+
this.lastRotation.copy(this.camera.rotation);
|
|
192
|
+
this.cameraMoveCallbacks.forEach((cb) => cb(this.camera.position.clone(), this.camera.rotation.clone()));
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export const cameraManager = CameraSingleton.getInstance();
|
|
199
|
+
export default cameraManager;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnchorSettings, Vector3Array } from "@3driseai/3drise-core";
|
|
2
|
+
export declare const applyAnchorSettings: (anchor: AnchorSettings | null | undefined, object: {
|
|
3
|
+
position: {
|
|
4
|
+
set: (x: number, y: number, z: number) => void;
|
|
5
|
+
};
|
|
6
|
+
rotation: {
|
|
7
|
+
set: (x: number, y: number, z: number) => void;
|
|
8
|
+
};
|
|
9
|
+
}, initialRotation?: Vector3Array) => void;
|
|
10
|
+
//# sourceMappingURL=anchorUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchorUtils.d.ts","sourceRoot":"","sources":["../../src/utils/anchorUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1E,eAAO,MAAM,mBAAmB,GAAI,QAAQ,cAAc,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ;IAC3E,QAAQ,EAAE;QACN,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;KAClD,CAAC;IACF,QAAQ,EAAE;QACN,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;KAClD,CAAC;CACL,EAAE,kBAAiB,YAAwB,KAAG,IAWtD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cameraManager } from './CameraSingleton.js';
|
|
2
|
+
export const applyAnchorSettings = (anchor, object, initialRotation = [0, 0, 0]) => {
|
|
3
|
+
if (!anchor || !anchor.enabled)
|
|
4
|
+
return;
|
|
5
|
+
if (anchor.fixedPosition) {
|
|
6
|
+
const p = cameraManager.getAnchorPosition(anchor.anchor || 'center', 0, anchor.offset || { y: 0, x: 0, z: 0 }, anchor.padding || 0);
|
|
7
|
+
object.position.set(p.x, p.y, p.z);
|
|
8
|
+
}
|
|
9
|
+
if (anchor.fixedRotation) {
|
|
10
|
+
const r = cameraManager.getRotation();
|
|
11
|
+
object.rotation.set(r.x + initialRotation[0], r.y + initialRotation[1], r.z + initialRotation[2]);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { CursorPickMode } from "@3driseai/3drise-core";
|
|
3
|
+
export interface CursorPickResult {
|
|
4
|
+
worldPos: THREE.Vector3;
|
|
5
|
+
hover: THREE.Intersection | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function pickCursorWorldPos(mode: CursorPickMode, raycaster: THREE.Raycaster, scene: THREE.Scene, camera: THREE.Camera, pointer: THREE.Vector2, planeDistance: number, out: THREE.Vector3): CursorPickResult;
|
|
8
|
+
//# sourceMappingURL=cursorPicking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursorPicking.d.ts","sourceRoot":"","sources":["../../src/utils/cursorPicking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CACpC;AAUD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,GAAG,gBAAgB,CA0BlN"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
const tmpPlane = new THREE.Plane();
|
|
3
|
+
const tmpNormal = new THREE.Vector3();
|
|
4
|
+
const tmpHitPoint = new THREE.Vector3();
|
|
5
|
+
function pickSceneHit(raycaster, scene) {
|
|
6
|
+
const hits = raycaster.intersectObjects(scene.children, true);
|
|
7
|
+
return hits.find(h => h.object.userData.interactible === true) ?? hits[0] ?? null;
|
|
8
|
+
}
|
|
9
|
+
export function pickCursorWorldPos(mode, raycaster, scene, camera, pointer, planeDistance, out) {
|
|
10
|
+
raycaster.setFromCamera(pointer, camera);
|
|
11
|
+
if (mode === 'raycast-scene') {
|
|
12
|
+
const hit = pickSceneHit(raycaster, scene);
|
|
13
|
+
if (hit) {
|
|
14
|
+
out.copy(hit.point);
|
|
15
|
+
return { worldPos: out, hover: hit };
|
|
16
|
+
}
|
|
17
|
+
// No hit → fall through to plane positioning, no hover.
|
|
18
|
+
}
|
|
19
|
+
// Build the screen-aligned plane in front of the camera.
|
|
20
|
+
camera.getWorldDirection(tmpNormal);
|
|
21
|
+
const planeOrigin = tmpHitPoint
|
|
22
|
+
.copy(camera.position)
|
|
23
|
+
.addScaledVector(tmpNormal, planeDistance);
|
|
24
|
+
tmpPlane.setFromNormalAndCoplanarPoint(tmpNormal, planeOrigin);
|
|
25
|
+
const hitPoint = raycaster.ray.intersectPlane(tmpPlane, out);
|
|
26
|
+
if (!hitPoint) {
|
|
27
|
+
out.copy(planeOrigin);
|
|
28
|
+
}
|
|
29
|
+
// raycast-plane still surfaces hover info from a separate scene query so
|
|
30
|
+
// cursor types (Comet, Sparkles, etc.) can react to objects they pass over
|
|
31
|
+
// while remaining positioned on the floating plane.
|
|
32
|
+
// `none` opts out entirely — cursor never reacts to scene contents.
|
|
33
|
+
const hover = mode === 'raycast-plane' ? pickSceneHit(raycaster, scene) : null;
|
|
34
|
+
return { worldPos: out, hover };
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BufferGeometry } from 'three';
|
|
2
|
+
export type OutlineMode = '2d' | '3d';
|
|
3
|
+
export type Point3 = [number, number, number];
|
|
4
|
+
/**
|
|
5
|
+
* 3D feature edges: every edge whose dihedral angle exceeds `angle` (degrees).
|
|
6
|
+
* Returns endpoints in segment order (pairs form independent segments).
|
|
7
|
+
*/
|
|
8
|
+
export declare function edges3D(geometry: BufferGeometry, angle: number): Point3[];
|
|
9
|
+
/**
|
|
10
|
+
* 2D profile: the hard edges lying on the front (max-Z) plane, flattened to
|
|
11
|
+
* z = 0. For a Z-extruded solid this equals the projected silhouette, so the
|
|
12
|
+
* heart yields its bezier contour and the box yields a square.
|
|
13
|
+
*
|
|
14
|
+
* For a general (non-extruded) mesh the true 2D outline is a projected
|
|
15
|
+
* silhouette boolean — swap this implementation when generalizing.
|
|
16
|
+
*/
|
|
17
|
+
export declare function contour2D(geometry: BufferGeometry): Point3[];
|
|
18
|
+
//# sourceMappingURL=extractOutline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractOutline.d.ts","sourceRoot":"","sources":["../../src/utils/extractOutline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtC,MAAM,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAKzE;AACD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,CAoB5D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { EdgesGeometry } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* 3D feature edges: every edge whose dihedral angle exceeds `angle` (degrees).
|
|
4
|
+
* Returns endpoints in segment order (pairs form independent segments).
|
|
5
|
+
*/
|
|
6
|
+
export function edges3D(geometry, angle) {
|
|
7
|
+
const edges = new EdgesGeometry(geometry, angle);
|
|
8
|
+
const pts = toPairs(edges.attributes.position.array);
|
|
9
|
+
edges.dispose();
|
|
10
|
+
return pts;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 2D profile: the hard edges lying on the front (max-Z) plane, flattened to
|
|
14
|
+
* z = 0. For a Z-extruded solid this equals the projected silhouette, so the
|
|
15
|
+
* heart yields its bezier contour and the box yields a square.
|
|
16
|
+
*
|
|
17
|
+
* For a general (non-extruded) mesh the true 2D outline is a projected
|
|
18
|
+
* silhouette boolean — swap this implementation when generalizing.
|
|
19
|
+
*/
|
|
20
|
+
export function contour2D(geometry) {
|
|
21
|
+
const edges = new EdgesGeometry(geometry, 1);
|
|
22
|
+
const a = edges.attributes.position.array;
|
|
23
|
+
let maxZ = -Infinity;
|
|
24
|
+
let minZ = Infinity;
|
|
25
|
+
for (let i = 2; i < a.length; i += 3) {
|
|
26
|
+
if (a[i] > maxZ)
|
|
27
|
+
maxZ = a[i];
|
|
28
|
+
if (a[i] < minZ)
|
|
29
|
+
minZ = a[i];
|
|
30
|
+
}
|
|
31
|
+
const eps = Math.max((maxZ - minZ) * 1e-3, 1e-4);
|
|
32
|
+
const out = [];
|
|
33
|
+
for (let i = 0; i < a.length; i += 6) {
|
|
34
|
+
if (Math.abs(a[i + 2] - maxZ) < eps && Math.abs(a[i + 5] - maxZ) < eps) {
|
|
35
|
+
out.push([a[i], a[i + 1], 0], [a[i + 3], a[i + 4], 0]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
edges.dispose();
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
function toPairs(arr) {
|
|
42
|
+
const out = [];
|
|
43
|
+
for (let i = 0; i < arr.length; i += 3) {
|
|
44
|
+
out.push([arr[i], arr[i + 1], arr[i + 2]]);
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
import type { TransformEffect, ColorEffect, EffectState } from "@3driseai/3drise-core";
|
|
3
|
+
export declare function shouldEffectBeActive(effect: TransformEffect | ColorEffect, hovered: boolean, clicked: boolean): boolean;
|
|
4
|
+
export declare function getActiveEffects<T extends TransformEffect | ColorEffect>(effects: T[], hovered: boolean, clicked: boolean): T[];
|
|
5
|
+
export declare function applyWaveEffect(object: Object3D, effect: TransformEffect, time: number, originalY: number): void;
|
|
6
|
+
export declare function applyFloatEffect(object: Object3D, effect: TransformEffect, time: number, originalPosition: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare function applyPulseEffect(object: Object3D, effect: TransformEffect, time: number, originalScale: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
}): void;
|
|
16
|
+
export declare function applyShakeEffect(object: Object3D, effect: TransformEffect, originalPosition: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}): void;
|
|
20
|
+
export declare function applyBounceEffect(object: Object3D, effect: TransformEffect, time: number, originalY: number): void;
|
|
21
|
+
export declare function applyRotate3DEffect(object: Object3D, effect: TransformEffect, time: number, originalRotation: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
z: number;
|
|
25
|
+
}): void;
|
|
26
|
+
export declare function applyFadeEffect(effect: TransformEffect, time: number): number;
|
|
27
|
+
export declare function applySpinEffect(object: Object3D, effect: TransformEffect, dt: number): void;
|
|
28
|
+
export declare function applySwayEffect(object: Object3D, effect: TransformEffect, time: number, originalRotation: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
z: number;
|
|
32
|
+
}): void;
|
|
33
|
+
export declare function applyFlipEffect(object: Object3D, effect: TransformEffect, isActive: boolean, dt: number, originalRotation: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
z: number;
|
|
37
|
+
}, sensitivity?: number): void;
|
|
38
|
+
export declare function applyScaleEffect(object: Object3D, effect: TransformEffect, isActive: boolean, dt: number, originalScale: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
z: number;
|
|
42
|
+
}, sensitivity?: number): void;
|
|
43
|
+
export declare function applyTransformEffects(object: Object3D, effects: TransformEffect[], time: number, dt: number, state: EffectState, hovered: boolean, clicked: boolean, sensitivity?: number): {
|
|
44
|
+
opacity?: number;
|
|
45
|
+
};
|
|
46
|
+
export declare function applyColorTransitionEffect(object: Object3D, effect: ColorEffect, isActive: boolean, dt: number, baseColors: Record<string, string>, applyToChildren?: boolean, sensitivity?: number): void;
|
|
47
|
+
export declare function applyPulseColorEffect(object: Object3D, effect: ColorEffect, time: number, baseColors: Record<string, string>, applyToChildren?: boolean): void;
|
|
48
|
+
export declare function applyAllColorEffects(object: Object3D, effects: ColorEffect[], time: number, dt: number, baseColors: Record<string, string>, hovered: boolean, clicked: boolean, applyToChildren?: boolean, sensitivity?: number): void;
|
|
49
|
+
//# sourceMappingURL=frameAnimations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameAnimations.d.ts","sourceRoot":"","sources":["../../src/utils/frameAnimations.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { easing } from 'maath';
|
|
2
|
+
import { Color } from 'three';
|
|
3
|
+
export function shouldEffectBeActive(effect, hovered, clicked) {
|
|
4
|
+
if (!effect.enabled)
|
|
5
|
+
return false;
|
|
6
|
+
const mode = effect.triggerMode ?? 'always';
|
|
7
|
+
switch (mode) {
|
|
8
|
+
case 'always': return true;
|
|
9
|
+
case 'hover': return hovered;
|
|
10
|
+
case 'click': return clicked;
|
|
11
|
+
default: return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function getActiveEffects(effects, hovered, clicked) {
|
|
15
|
+
return effects.filter(effect => shouldEffectBeActive(effect, hovered, clicked));
|
|
16
|
+
}
|
|
17
|
+
export function applyWaveEffect(object, effect, time, originalY) {
|
|
18
|
+
const options = effect.options;
|
|
19
|
+
const amplitude = options?.amplitude ?? 0.1;
|
|
20
|
+
const frequency = options?.frequency ?? 2;
|
|
21
|
+
object.position.y = originalY + Math.sin(time * frequency * (effect.speed ?? 1)) * amplitude * (effect.intensity ?? 1);
|
|
22
|
+
}
|
|
23
|
+
export function applyFloatEffect(object, effect, time, originalPosition) {
|
|
24
|
+
const options = effect.options;
|
|
25
|
+
const speed = effect.speed ?? 1;
|
|
26
|
+
const intensity = effect.intensity ?? 1;
|
|
27
|
+
object.position.x = originalPosition.x + Math.cos(time * speed * 0.5) * ((options?.amplitudeX ?? 0.05) * intensity);
|
|
28
|
+
object.position.y = originalPosition.y + Math.sin(time * speed) * ((options?.amplitudeY ?? 0.1) * intensity);
|
|
29
|
+
object.position.z = originalPosition.z + Math.sin(time * speed * 0.3) * ((options?.amplitudeZ ?? 0.03) * intensity);
|
|
30
|
+
}
|
|
31
|
+
export function applyPulseEffect(object, effect, time, originalScale) {
|
|
32
|
+
const options = effect.options;
|
|
33
|
+
const minScale = options?.minScale ?? 0.95;
|
|
34
|
+
const maxScale = options?.maxScale ?? 1.05;
|
|
35
|
+
const scaleFactor = minScale + (Math.sin(time * (effect.speed ?? 2)) + 1) * 0.5 * (maxScale - minScale);
|
|
36
|
+
object.scale.set(originalScale.x * scaleFactor, originalScale.y * scaleFactor, originalScale.z * scaleFactor);
|
|
37
|
+
}
|
|
38
|
+
export function applyShakeEffect(object, effect, originalPosition) {
|
|
39
|
+
const options = effect.options;
|
|
40
|
+
const intensity = effect.intensity ?? 1;
|
|
41
|
+
object.position.x = originalPosition.x + (Math.random() - 0.5) * ((options?.amplitudeX ?? 0.02) * intensity);
|
|
42
|
+
object.position.y = originalPosition.y + (Math.random() - 0.5) * ((options?.amplitudeY ?? 0.02) * intensity);
|
|
43
|
+
}
|
|
44
|
+
export function applyBounceEffect(object, effect, time, originalY) {
|
|
45
|
+
const options = effect.options;
|
|
46
|
+
object.position.y = originalY + Math.abs(Math.sin(time * (effect.speed ?? 3))) * (options?.bounceHeight ?? 0.2) * (effect.intensity ?? 1);
|
|
47
|
+
}
|
|
48
|
+
export function applyRotate3DEffect(object, effect, time, originalRotation) {
|
|
49
|
+
const options = effect.options;
|
|
50
|
+
const speed = effect.speed ?? 1;
|
|
51
|
+
const intensity = (effect.intensity ?? 1) * 0.1;
|
|
52
|
+
if (options?.axisX !== false)
|
|
53
|
+
object.rotation.x = originalRotation.x + Math.cos(time * speed * 0.7) * intensity * 0.5;
|
|
54
|
+
if (options?.axisY !== false)
|
|
55
|
+
object.rotation.y = originalRotation.y + Math.sin(time * speed) * intensity;
|
|
56
|
+
if (options?.axisZ)
|
|
57
|
+
object.rotation.z = originalRotation.z + Math.sin(time * speed * 0.5) * intensity * 0.3;
|
|
58
|
+
}
|
|
59
|
+
export function applyFadeEffect(effect, time) {
|
|
60
|
+
const options = effect.options;
|
|
61
|
+
const fadeMin = options?.fadeMin ?? 0.3;
|
|
62
|
+
const fadeMax = options?.fadeMax ?? 1;
|
|
63
|
+
return fadeMin + (Math.sin(time * (effect.speed ?? 1)) + 1) * 0.5 * (fadeMax - fadeMin);
|
|
64
|
+
}
|
|
65
|
+
export function applySpinEffect(object, effect, dt) {
|
|
66
|
+
const options = effect.options;
|
|
67
|
+
const axis = options?.axis ?? 'y';
|
|
68
|
+
object.rotation[axis] += dt * (effect.speed ?? 1);
|
|
69
|
+
}
|
|
70
|
+
export function applySwayEffect(object, effect, time, originalRotation) {
|
|
71
|
+
const options = effect.options;
|
|
72
|
+
const axis = options?.axis ?? 'z';
|
|
73
|
+
object.rotation[axis] = originalRotation[axis] + Math.sin(time * (effect.speed ?? 1)) * (options?.angle ?? 0.2) * (effect.intensity ?? 1);
|
|
74
|
+
}
|
|
75
|
+
export function applyFlipEffect(object, effect, isActive, dt, originalRotation, sensitivity = 0.5) {
|
|
76
|
+
const options = effect.options;
|
|
77
|
+
const axis = options?.axis ?? 'y';
|
|
78
|
+
const dampSpeed = (effect.speed ?? 0.3) * (1 - sensitivity * 0.5);
|
|
79
|
+
easing.damp(object.rotation, axis, isActive ? originalRotation[axis] + Math.PI : originalRotation[axis], dampSpeed, dt);
|
|
80
|
+
}
|
|
81
|
+
export function applyScaleEffect(object, effect, isActive, dt, originalScale, sensitivity = 0.5) {
|
|
82
|
+
const options = effect.options;
|
|
83
|
+
const targetScale = options?.targetScale ?? 1.2;
|
|
84
|
+
const dampSpeed = (effect.speed ?? 0.1) * (1 - sensitivity * 0.5);
|
|
85
|
+
const scale = isActive
|
|
86
|
+
? [originalScale.x * targetScale, originalScale.y * targetScale, originalScale.z * targetScale]
|
|
87
|
+
: [originalScale.x, originalScale.y, originalScale.z];
|
|
88
|
+
easing.damp3(object.scale, scale, dampSpeed, dt);
|
|
89
|
+
}
|
|
90
|
+
export function applyTransformEffects(object, effects, time, dt, state, hovered, clicked, sensitivity = 0.5) {
|
|
91
|
+
const result = {};
|
|
92
|
+
for (const effect of effects) {
|
|
93
|
+
const isActive = shouldEffectBeActive(effect, hovered, clicked);
|
|
94
|
+
if (!isActive)
|
|
95
|
+
continue;
|
|
96
|
+
switch (effect.type) {
|
|
97
|
+
case 'wave':
|
|
98
|
+
applyWaveEffect(object, effect, time, state.originalPosition.y);
|
|
99
|
+
break;
|
|
100
|
+
case 'float':
|
|
101
|
+
applyFloatEffect(object, effect, time, state.originalPosition);
|
|
102
|
+
break;
|
|
103
|
+
case 'pulse':
|
|
104
|
+
applyPulseEffect(object, effect, time, state.originalScale);
|
|
105
|
+
break;
|
|
106
|
+
case 'shake':
|
|
107
|
+
applyShakeEffect(object, effect, state.originalPosition);
|
|
108
|
+
break;
|
|
109
|
+
case 'bounce':
|
|
110
|
+
applyBounceEffect(object, effect, time, state.originalPosition.y);
|
|
111
|
+
break;
|
|
112
|
+
case 'rotate3d':
|
|
113
|
+
applyRotate3DEffect(object, effect, time, state.originalRotation);
|
|
114
|
+
break;
|
|
115
|
+
case 'fade':
|
|
116
|
+
result.opacity = applyFadeEffect(effect, time);
|
|
117
|
+
break;
|
|
118
|
+
case 'spin':
|
|
119
|
+
applySpinEffect(object, effect, dt);
|
|
120
|
+
break;
|
|
121
|
+
case 'sway':
|
|
122
|
+
applySwayEffect(object, effect, time, state.originalRotation);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const effect of effects) {
|
|
127
|
+
if (!effect.enabled)
|
|
128
|
+
continue;
|
|
129
|
+
const isActive = shouldEffectBeActive(effect, hovered, clicked);
|
|
130
|
+
switch (effect.type) {
|
|
131
|
+
case 'flip':
|
|
132
|
+
applyFlipEffect(object, effect, isActive, dt, state.originalRotation, sensitivity);
|
|
133
|
+
break;
|
|
134
|
+
case 'scale':
|
|
135
|
+
applyScaleEffect(object, effect, isActive, dt, state.originalScale, sensitivity);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
function getColorFromPath(material, path) {
|
|
142
|
+
let current = material;
|
|
143
|
+
for (const part of path.split('.')) {
|
|
144
|
+
if (current == null)
|
|
145
|
+
return null;
|
|
146
|
+
current = current[part];
|
|
147
|
+
}
|
|
148
|
+
if (current?.value instanceof Color)
|
|
149
|
+
return current.value;
|
|
150
|
+
if (current instanceof Color)
|
|
151
|
+
return current;
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
export function applyColorTransitionEffect(object, effect, isActive, dt, baseColors, applyToChildren = true, sensitivity = 0.5) {
|
|
155
|
+
const targetProperties = effect.targetProperties ?? ['color'];
|
|
156
|
+
const targetColor = isActive ? effect.targetColor : null;
|
|
157
|
+
const dampSpeed = 0.1 * (1 - sensitivity * 0.5);
|
|
158
|
+
const applyToMaterial = (material) => {
|
|
159
|
+
for (const propPath of targetProperties) {
|
|
160
|
+
const color = getColorFromPath(material, propPath);
|
|
161
|
+
if (color)
|
|
162
|
+
easing.dampC(color, targetColor || baseColors[propPath] || '#ffffff', dampSpeed, dt);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
if (applyToChildren)
|
|
166
|
+
object.traverse((child) => { if (child.material)
|
|
167
|
+
applyToMaterial(child.material); });
|
|
168
|
+
else {
|
|
169
|
+
const mesh = object;
|
|
170
|
+
if (mesh.material)
|
|
171
|
+
applyToMaterial(mesh.material);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export function applyPulseColorEffect(object, effect, time, baseColors, applyToChildren = true) {
|
|
175
|
+
const targetProperties = effect.targetProperties ?? ['color'];
|
|
176
|
+
const blend = (Math.sin(time * (effect.speed ?? 1) * 2) + 1) * 0.5 * (effect.intensity ?? 1);
|
|
177
|
+
const baseColorObj = new Color();
|
|
178
|
+
const targetColorObj = new Color(effect.targetColor);
|
|
179
|
+
const resultColor = new Color();
|
|
180
|
+
const applyToMaterial = (material) => {
|
|
181
|
+
for (const propPath of targetProperties) {
|
|
182
|
+
const color = getColorFromPath(material, propPath);
|
|
183
|
+
if (color) {
|
|
184
|
+
baseColorObj.set(baseColors[propPath] || '#ffffff');
|
|
185
|
+
color.copy(resultColor.copy(baseColorObj).lerp(targetColorObj, blend));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
if (applyToChildren)
|
|
190
|
+
object.traverse((child) => { if (child.material)
|
|
191
|
+
applyToMaterial(child.material); });
|
|
192
|
+
else {
|
|
193
|
+
const mesh = object;
|
|
194
|
+
if (mesh.material)
|
|
195
|
+
applyToMaterial(mesh.material);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export function applyAllColorEffects(object, effects, time, dt, baseColors, hovered, clicked, applyToChildren = true, sensitivity = 0.5) {
|
|
199
|
+
for (const effect of effects) {
|
|
200
|
+
if (!effect.enabled)
|
|
201
|
+
continue;
|
|
202
|
+
const isActive = shouldEffectBeActive(effect, hovered, clicked);
|
|
203
|
+
switch (effect.type) {
|
|
204
|
+
case 'color-transition':
|
|
205
|
+
applyColorTransitionEffect(object, effect, isActive, dt, baseColors, applyToChildren, sensitivity);
|
|
206
|
+
break;
|
|
207
|
+
case 'pulse-color':
|
|
208
|
+
if (isActive)
|
|
209
|
+
applyPulseColorEffect(object, effect, time, baseColors, applyToChildren);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
+
export declare const DEBUG_GENERATIVE_EFFECTS = false;
|
|
4
|
+
export declare function applyGenerativeAnimations(materials: THREE.ShaderMaterial[], animations: AnimationOptions[] | undefined, startValuesCache: Record<string, any>, currentTime: number, hovered: boolean): void;
|
|
5
|
+
//# sourceMappingURL=handleGenerativeEffectsAnimations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGenerativeEffectsAnimations.d.ts","sourceRoot":"","sources":["../../src/utils/handleGenerativeEffectsAnimations.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAuG9D,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAkF9C,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CA+D3M"}
|