@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,143 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
// Single rich shader handles scanlines, grid, RGB aberration, interference fringes, flicker
|
|
7
|
+
const vertexShader = /* glsl */ `
|
|
8
|
+
varying vec2 vUv;
|
|
9
|
+
void main() {
|
|
10
|
+
vUv = uv;
|
|
11
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const fragmentShader = /* glsl */ `
|
|
15
|
+
uniform float u_time;
|
|
16
|
+
uniform float uScanSpeed;
|
|
17
|
+
uniform float uScanlineCount;
|
|
18
|
+
uniform vec3 uColor;
|
|
19
|
+
uniform float uOpacity;
|
|
20
|
+
uniform float uFlickerAmount;
|
|
21
|
+
uniform float uGridEnabled;
|
|
22
|
+
uniform float uGlitchOffset;
|
|
23
|
+
uniform float uAberration; // chromatic aberration intensity
|
|
24
|
+
uniform float uPlaneY; // -1..1 normalized plane position
|
|
25
|
+
uniform float uIntensity;
|
|
26
|
+
|
|
27
|
+
varying vec2 vUv;
|
|
28
|
+
|
|
29
|
+
float hash(float n){ return fract(sin(n) * 43758.5453); }
|
|
30
|
+
float hash2(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
|
|
31
|
+
|
|
32
|
+
// Scanline sample at a specific UV (shared logic, called 3× for RGB split)
|
|
33
|
+
float scanSample(vec2 uv, float t) {
|
|
34
|
+
return step(0.45, fract(uv.y * uScanlineCount + t * uScanSpeed));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void main() {
|
|
38
|
+
vec2 uv = vUv;
|
|
39
|
+
float t = u_time;
|
|
40
|
+
|
|
41
|
+
// ── Glitch: rectangular block shift ────────────────────────────────────
|
|
42
|
+
float blockY = floor(uv.y * 8.0);
|
|
43
|
+
float glitchT = hash(blockY + floor(t * 12.0));
|
|
44
|
+
float doGlitch= step(0.94, glitchT);
|
|
45
|
+
uv.x += doGlitch * (hash(blockY * 3.1 + t * 4.0) - 0.5) * uGlitchOffset;
|
|
46
|
+
uv.x = fract(uv.x);
|
|
47
|
+
|
|
48
|
+
// ── RGB chromatic aberration ───────────────────────────────────────────
|
|
49
|
+
float aberr = uAberration * (1.0 + 0.4 * sin(t * 3.0));
|
|
50
|
+
float r_val = scanSample(uv + vec2( aberr, 0.0), t);
|
|
51
|
+
float g_val = scanSample(uv, t);
|
|
52
|
+
float b_val = scanSample(uv - vec2( aberr, 0.0), t);
|
|
53
|
+
vec3 scanRGB = vec3(r_val, g_val, b_val);
|
|
54
|
+
|
|
55
|
+
// ── Interference fringe pattern ────────────────────────────────────────
|
|
56
|
+
// Moiré-like bands that drift across the plane
|
|
57
|
+
float fringe = sin(uv.y * 60.0 + t * 4.0) * sin(uv.x * 40.0 - t * 2.0) * 0.5 + 0.5;
|
|
58
|
+
fringe = pow(fringe, 3.0) * 0.35;
|
|
59
|
+
|
|
60
|
+
// ── Grid overlay ───────────────────────────────────────────────────────
|
|
61
|
+
float grid = 0.0;
|
|
62
|
+
if (uGridEnabled > 0.5) {
|
|
63
|
+
float gx = step(0.93, fract(uv.x * 14.0));
|
|
64
|
+
float gy = step(0.93, fract(uv.y * 14.0));
|
|
65
|
+
grid = max(gx, gy) * 0.5;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ── Assembly animation: plane lights up from bottom ────────────────────
|
|
69
|
+
// uPlaneY goes -1 (bottom) to +1 (top); assemble = time-based sweep
|
|
70
|
+
float assembleT = mod(t * 0.3, 2.5);
|
|
71
|
+
float assembled = smoothstep(assembleT - 0.4, assembleT, uPlaneY * 0.5 + 0.5);
|
|
72
|
+
// Once fully assembled, stay on; only flicker during initial assembly
|
|
73
|
+
float stableT = smoothstep(0.0, 1.2, assembleT);
|
|
74
|
+
float assembleA = mix(assembled, 1.0, stableT);
|
|
75
|
+
|
|
76
|
+
// ── Flicker ────────────────────────────────────────────────────────────
|
|
77
|
+
float flicker = 1.0 - uFlickerAmount * step(0.93, hash(floor(t * 18.0)));
|
|
78
|
+
|
|
79
|
+
// ── Composite ─────────────────────────────────────────────────────────
|
|
80
|
+
vec3 hologramColor = uColor * scanRGB;
|
|
81
|
+
float scanBright = (r_val + g_val + b_val) / 3.0;
|
|
82
|
+
float intensity = (scanBright * 0.65 + fringe + grid) * flicker * assembleA * uIntensity;
|
|
83
|
+
if (intensity < 0.015) discard;
|
|
84
|
+
|
|
85
|
+
gl_FragColor = vec4(hologramColor + uColor * fringe, intensity * uOpacity);
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
const HologramEffect = ({ boundingRadius, config, animations }) => {
|
|
89
|
+
const { scanlineCount, scanSpeed, scanColor, gridEnabled, flickerAmount, glitchEnabled, opacity, speed, intensity } = config;
|
|
90
|
+
const startValuesCacheRef = useRef({});
|
|
91
|
+
const meshRefs = useRef([]);
|
|
92
|
+
const colorVec = useMemo(() => {
|
|
93
|
+
const c = new THREE.Color(scanColor);
|
|
94
|
+
return new THREE.Vector3(c.r, c.g, c.b);
|
|
95
|
+
}, [scanColor]);
|
|
96
|
+
// One material per plane — each has its own uPlaneY so the assembly sweeps correctly
|
|
97
|
+
const materials = useMemo(() => Array.from({ length: scanlineCount }, (_, i) => {
|
|
98
|
+
const planeY = (i / Math.max(scanlineCount - 1, 1)) * 2 - 1; // -1..+1
|
|
99
|
+
return new THREE.ShaderMaterial({
|
|
100
|
+
vertexShader,
|
|
101
|
+
fragmentShader,
|
|
102
|
+
uniforms: {
|
|
103
|
+
u_time: { value: 0 },
|
|
104
|
+
uScanSpeed: { value: scanSpeed * speed },
|
|
105
|
+
uScanlineCount: { value: 5.0 + i * 0.3 }, // slight variation per plane
|
|
106
|
+
uColor: { value: colorVec },
|
|
107
|
+
uOpacity: { value: opacity * intensity },
|
|
108
|
+
uFlickerAmount: { value: flickerAmount },
|
|
109
|
+
uGridEnabled: { value: gridEnabled ? 1.0 : 0.0 },
|
|
110
|
+
uGlitchOffset: { value: 0 },
|
|
111
|
+
uAberration: { value: 0.012 },
|
|
112
|
+
uPlaneY: { value: planeY },
|
|
113
|
+
uIntensity: { value: intensity },
|
|
114
|
+
},
|
|
115
|
+
transparent: true,
|
|
116
|
+
depthWrite: false,
|
|
117
|
+
blending: THREE.AdditiveBlending,
|
|
118
|
+
side: THREE.DoubleSide,
|
|
119
|
+
});
|
|
120
|
+
}), [scanlineCount, scanSpeed, speed, colorVec, opacity, intensity, flickerAmount, gridEnabled]);
|
|
121
|
+
const planeSize = boundingRadius * 2.3;
|
|
122
|
+
const stepY = (boundingRadius * 2.5) / Math.max(scanlineCount - 1, 1);
|
|
123
|
+
useFrame((state) => {
|
|
124
|
+
const t = state.clock.getElapsedTime();
|
|
125
|
+
materials.forEach((mat, i) => {
|
|
126
|
+
mat.uniforms.u_time.value = t + i * 0.04;
|
|
127
|
+
if (glitchEnabled && Math.random() > 0.985) {
|
|
128
|
+
mat.uniforms.uGlitchOffset.value = (Math.random() - 0.5) * 0.06;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
mat.uniforms.uGlitchOffset.value *= 0.80;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (animations?.length) {
|
|
135
|
+
applyGenerativeAnimations(materials, animations, startValuesCacheRef.current, Date.now(), false);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return (_jsx("group", { children: Array.from({ length: scanlineCount }, (_, i) => {
|
|
139
|
+
const y = -boundingRadius * 1.25 + i * stepY;
|
|
140
|
+
return (_jsx("mesh", { ref: el => { meshRefs.current[i] = el; }, material: materials[i], position: [0, y, 0], rotation: [-Math.PI / 2, 0, 0], children: _jsx("planeGeometry", { args: [planeSize, planeSize, 2, 2] }) }, i));
|
|
141
|
+
}) }));
|
|
142
|
+
};
|
|
143
|
+
export default HologramEffect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { IceCrystalsConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
+
interface IceCrystalsEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: IceCrystalsConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const IceCrystalsEffect: React.FC<IceCrystalsEffectProps>;
|
|
9
|
+
export default IceCrystalsEffect;
|
|
10
|
+
//# sourceMappingURL=IceCrystalsEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IceCrystalsEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/IceCrystalsEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACjF,UAAU,sBAAsB;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAmED,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAuHvD,CAAC;AACF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
// ── Crystal spike shader ──────────────────────────────────────────────────────
|
|
7
|
+
const spikeVert = /* glsl */ `
|
|
8
|
+
varying vec3 vNormal;
|
|
9
|
+
varying vec3 vWorldPos;
|
|
10
|
+
void main() {
|
|
11
|
+
vNormal = normalize(normalMatrix * normal);
|
|
12
|
+
vWorldPos = (modelMatrix * vec4(position, 1.0)).xyz;
|
|
13
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const spikeFrag = /* glsl */ `
|
|
17
|
+
uniform vec3 uIceColor;
|
|
18
|
+
uniform float uOpacity;
|
|
19
|
+
uniform float uIntensity;
|
|
20
|
+
varying vec3 vNormal;
|
|
21
|
+
varying vec3 vWorldPos;
|
|
22
|
+
|
|
23
|
+
void main() {
|
|
24
|
+
vec3 viewDir = normalize(cameraPosition - vWorldPos);
|
|
25
|
+
vec3 n = normalize(vNormal);
|
|
26
|
+
|
|
27
|
+
// Specular glint — sharp facet reflection
|
|
28
|
+
vec3 h = normalize(viewDir + vec3(0.6, 1.0, 0.4));
|
|
29
|
+
float spec = pow(max(dot(n, h), 0.0), 38.0) * 2.5;
|
|
30
|
+
|
|
31
|
+
// Fresnel edge glow
|
|
32
|
+
float fresnel = pow(1.0 - abs(dot(n, viewDir)), 2.0);
|
|
33
|
+
|
|
34
|
+
// Facet shading: vary brightness by normal orientation
|
|
35
|
+
float shade = 0.5 + 0.5 * abs(dot(n, normalize(vec3(1.0, 2.0, 0.5))));
|
|
36
|
+
|
|
37
|
+
vec3 col = uIceColor * shade + vec3(spec) + vec3(0.6, 0.9, 1.0) * fresnel * 0.5;
|
|
38
|
+
float alpha = (shade * 0.5 + fresnel * 0.35 + spec * 0.15) * uOpacity * uIntensity;
|
|
39
|
+
gl_FragColor = vec4(col, clamp(alpha, 0.0, 1.0));
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
// ── Frost particle shader ─────────────────────────────────────────────────────
|
|
43
|
+
const frostVert = /* glsl */ `
|
|
44
|
+
attribute float aBaseY;
|
|
45
|
+
attribute float aSize;
|
|
46
|
+
attribute vec2 aXZ;
|
|
47
|
+
uniform float u_time;
|
|
48
|
+
uniform float uRange;
|
|
49
|
+
varying float vA;
|
|
50
|
+
void main() {
|
|
51
|
+
float y = mod(aBaseY - u_time * 0.35, uRange) - uRange * 0.5;
|
|
52
|
+
vec3 pos = vec3(aXZ.x, y, aXZ.y);
|
|
53
|
+
vA = 0.4 + 0.6 * smoothstep(-uRange * 0.5, -uRange * 0.3, y)
|
|
54
|
+
* smoothstep(uRange * 0.5, uRange * 0.3, y);
|
|
55
|
+
vec4 mv = modelViewMatrix * vec4(pos, 1.0);
|
|
56
|
+
gl_PointSize = aSize * (180.0 / -mv.z);
|
|
57
|
+
gl_Position = projectionMatrix * mv;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const frostFrag = /* glsl */ `
|
|
61
|
+
uniform float uOpacity;
|
|
62
|
+
varying float vA;
|
|
63
|
+
void main() {
|
|
64
|
+
vec2 c = gl_PointCoord - 0.5;
|
|
65
|
+
if (length(c) > 0.5) discard;
|
|
66
|
+
float g = exp(-dot(c, c) * 6.0);
|
|
67
|
+
gl_FragColor = vec4(0.85, 0.95, 1.0, g * vA * uOpacity);
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
const IceCrystalsEffect = ({ boundingRadius, config, animations }) => {
|
|
71
|
+
const { spikeCount, spikeLength, frostEnabled, iceColor, pulseSpeed, opacity, intensity } = config;
|
|
72
|
+
const startValuesCacheRef = useRef({});
|
|
73
|
+
const groupRef = useRef(null);
|
|
74
|
+
const timeRef = useRef(0);
|
|
75
|
+
const r = boundingRadius;
|
|
76
|
+
const N = Math.max(10, Math.min(spikeCount, 60));
|
|
77
|
+
const { spikeMesh, spikeMat, frostGeo, frostMat } = useMemo(() => {
|
|
78
|
+
const ic = new THREE.Color(iceColor);
|
|
79
|
+
// ── Spike instanced mesh ─────────────────────────────────────────────
|
|
80
|
+
const spikeLen = r * spikeLength * 0.55;
|
|
81
|
+
const spikeBase = r * 0.055 * intensity;
|
|
82
|
+
const spikeGeo = new THREE.ConeGeometry(spikeBase, spikeLen, 5);
|
|
83
|
+
// Shift cone so its base is at origin (tip points up in local space)
|
|
84
|
+
spikeGeo.translate(0, spikeLen / 2, 0);
|
|
85
|
+
const sMat = new THREE.ShaderMaterial({
|
|
86
|
+
vertexShader: spikeVert,
|
|
87
|
+
fragmentShader: spikeFrag,
|
|
88
|
+
uniforms: {
|
|
89
|
+
uIceColor: { value: new THREE.Vector3(ic.r, ic.g, ic.b) },
|
|
90
|
+
uOpacity: { value: opacity },
|
|
91
|
+
uIntensity: { value: intensity },
|
|
92
|
+
},
|
|
93
|
+
transparent: true,
|
|
94
|
+
depthWrite: false,
|
|
95
|
+
blending: THREE.AdditiveBlending,
|
|
96
|
+
side: THREE.DoubleSide,
|
|
97
|
+
});
|
|
98
|
+
const mesh = new THREE.InstancedMesh(spikeGeo, sMat, N);
|
|
99
|
+
mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
|
|
100
|
+
// Position spikes on Fibonacci sphere, pointing radially outward
|
|
101
|
+
const tmpPos = new THREE.Vector3();
|
|
102
|
+
const tmpQuat = new THREE.Quaternion();
|
|
103
|
+
const tmpMat = new THREE.Matrix4();
|
|
104
|
+
const UP = new THREE.Vector3(0, 1, 0);
|
|
105
|
+
const goldenAngle = Math.PI * (3 - Math.sqrt(5));
|
|
106
|
+
for (let i = 0; i < N; i++) {
|
|
107
|
+
const y = 1 - (i / (N - 1)) * 2;
|
|
108
|
+
const rad = Math.sqrt(1 - y * y) * r;
|
|
109
|
+
const phi = i * goldenAngle;
|
|
110
|
+
tmpPos.set(Math.cos(phi) * rad, y * r, Math.sin(phi) * rad);
|
|
111
|
+
// Quaternion: rotate Y-up to radial direction
|
|
112
|
+
const dir = tmpPos.clone().normalize();
|
|
113
|
+
tmpQuat.setFromUnitVectors(UP, dir);
|
|
114
|
+
// Scale Y randomly for variety
|
|
115
|
+
const scaleY = 0.6 + Math.random() * 0.8;
|
|
116
|
+
tmpMat.compose(tmpPos, tmpQuat, new THREE.Vector3(1, scaleY, 1));
|
|
117
|
+
mesh.setMatrixAt(i, tmpMat);
|
|
118
|
+
}
|
|
119
|
+
mesh.instanceMatrix.needsUpdate = true;
|
|
120
|
+
// ── Frost particles ──────────────────────────────────────────────────
|
|
121
|
+
const FN = 180;
|
|
122
|
+
const range = r * 2.5;
|
|
123
|
+
const fBaseY = new Float32Array(FN);
|
|
124
|
+
const fSize = new Float32Array(FN);
|
|
125
|
+
const fXZ = new Float32Array(FN * 2);
|
|
126
|
+
for (let i = 0; i < FN; i++) {
|
|
127
|
+
fBaseY[i] = Math.random() * range;
|
|
128
|
+
fSize[i] = 1.5 + Math.random() * 3.0;
|
|
129
|
+
const a = Math.random() * Math.PI * 2;
|
|
130
|
+
const fr = (0.9 + Math.random() * 0.8) * r;
|
|
131
|
+
fXZ[i * 2] = Math.cos(a) * fr;
|
|
132
|
+
fXZ[i * 2 + 1] = Math.sin(a) * fr;
|
|
133
|
+
}
|
|
134
|
+
const fGeo = new THREE.BufferGeometry();
|
|
135
|
+
fGeo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(FN * 3), 3));
|
|
136
|
+
fGeo.setAttribute('aBaseY', new THREE.BufferAttribute(fBaseY, 1));
|
|
137
|
+
fGeo.setAttribute('aSize', new THREE.BufferAttribute(fSize, 1));
|
|
138
|
+
fGeo.setAttribute('aXZ', new THREE.BufferAttribute(fXZ, 2));
|
|
139
|
+
fGeo.frustumCulled = false;
|
|
140
|
+
const fMat = new THREE.ShaderMaterial({
|
|
141
|
+
vertexShader: frostVert,
|
|
142
|
+
fragmentShader: frostFrag,
|
|
143
|
+
uniforms: {
|
|
144
|
+
u_time: { value: 0 },
|
|
145
|
+
uRange: { value: range },
|
|
146
|
+
uOpacity: { value: opacity * 0.55 },
|
|
147
|
+
},
|
|
148
|
+
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
149
|
+
});
|
|
150
|
+
return { spikeMesh: mesh, spikeMat: sMat, frostGeo: fGeo, frostMat: fMat };
|
|
151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
+
}, [N, r, spikeLength, iceColor, opacity, intensity]);
|
|
153
|
+
// Pulse scale animation on spikes
|
|
154
|
+
const pulseMats = useRef([]);
|
|
155
|
+
useMemo(() => {
|
|
156
|
+
const tmpMat = new THREE.Matrix4();
|
|
157
|
+
const tmpPos = new THREE.Vector3();
|
|
158
|
+
const tmpQuat = new THREE.Quaternion();
|
|
159
|
+
const tmpScale = new THREE.Vector3();
|
|
160
|
+
pulseMats.current = Array.from({ length: N }, (_, i) => {
|
|
161
|
+
spikeMesh.getMatrixAt(i, tmpMat);
|
|
162
|
+
return tmpMat.clone();
|
|
163
|
+
});
|
|
164
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
165
|
+
}, [spikeMesh, N]);
|
|
166
|
+
useFrame((state, delta) => {
|
|
167
|
+
timeRef.current += delta;
|
|
168
|
+
const t = timeRef.current;
|
|
169
|
+
frostMat.uniforms.u_time.value = t;
|
|
170
|
+
// Subtle spike pulse: scale Y slightly up/down per spike
|
|
171
|
+
const tmpMat = new THREE.Matrix4();
|
|
172
|
+
const tmpPos = new THREE.Vector3();
|
|
173
|
+
const tmpQuat = new THREE.Quaternion();
|
|
174
|
+
const tmpScale = new THREE.Vector3();
|
|
175
|
+
for (let i = 0; i < N; i++) {
|
|
176
|
+
const base = pulseMats.current[i];
|
|
177
|
+
base.decompose(tmpPos, tmpQuat, tmpScale);
|
|
178
|
+
const pulse = 0.88 + 0.12 * Math.sin(t * pulseSpeed * 1.8 + i * 0.47);
|
|
179
|
+
tmpScale.y = pulse;
|
|
180
|
+
tmpMat.compose(tmpPos, tmpQuat, tmpScale);
|
|
181
|
+
spikeMesh.setMatrixAt(i, tmpMat);
|
|
182
|
+
}
|
|
183
|
+
spikeMesh.instanceMatrix.needsUpdate = true;
|
|
184
|
+
if (animations?.length) {
|
|
185
|
+
applyGenerativeAnimations([spikeMat, frostMat], animations, startValuesCacheRef.current, Date.now(), false);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return (_jsxs("group", { ref: groupRef, children: [_jsx("primitive", { object: spikeMesh }), frostEnabled && _jsx("points", { geometry: frostGeo, material: frostMat })] }));
|
|
189
|
+
};
|
|
190
|
+
export default IceCrystalsEffect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { LightningConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
3
|
+
interface LightningEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: LightningConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const LightningEffect: React.FC<LightningEffectProps>;
|
|
9
|
+
export default LightningEffect;
|
|
10
|
+
//# sourceMappingURL=LightningEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightningEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/LightningEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,UAAU,oBAAoB;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAsDD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsLnD,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { applyGenerativeAnimations } from '../../utils/handleGenerativeEffectsAnimations.js';
|
|
6
|
+
// ── Seeded LCG RNG — deterministic, no Math.random ───────────────────────────
|
|
7
|
+
function makeRng(seed) {
|
|
8
|
+
let s = (seed * 1664525 + 1013904223) >>> 0;
|
|
9
|
+
return () => { s = (s * 1664525 + 1013904223) >>> 0; return s / 0xffffffff; };
|
|
10
|
+
}
|
|
11
|
+
// ── Fractal midpoint displacement → ordered polyline ─────────────────────────
|
|
12
|
+
// Returns 2^depth + 1 points
|
|
13
|
+
function fractalPolyline(start, end, depth, rng) {
|
|
14
|
+
if (depth === 0)
|
|
15
|
+
return [start.clone(), end.clone()];
|
|
16
|
+
const mid = start.clone().lerp(end, 0.42 + rng() * 0.16);
|
|
17
|
+
const dir = end.clone().sub(start);
|
|
18
|
+
const len = dir.length();
|
|
19
|
+
dir.normalize();
|
|
20
|
+
let perp1 = new THREE.Vector3(dir.z, 0, -dir.x);
|
|
21
|
+
if (perp1.lengthSq() < 0.001)
|
|
22
|
+
perp1.set(0, dir.z, -dir.y);
|
|
23
|
+
perp1.normalize();
|
|
24
|
+
const perp2 = dir.clone().cross(perp1).normalize();
|
|
25
|
+
const spread = len * 0.38;
|
|
26
|
+
mid.addScaledVector(perp1, (rng() - 0.5) * 2 * spread);
|
|
27
|
+
mid.addScaledVector(perp2, (rng() - 0.5) * spread * 0.7);
|
|
28
|
+
const a = fractalPolyline(start, mid, depth - 1, rng);
|
|
29
|
+
const b = fractalPolyline(mid, end, depth - 1, rng);
|
|
30
|
+
return [...a.slice(0, -1), ...b]; // merge without duplicating midpoint
|
|
31
|
+
}
|
|
32
|
+
// ── Glow sprite shader ─────────────────────────────────────────────────────────
|
|
33
|
+
const glowVert = /* glsl */ `
|
|
34
|
+
attribute float aBrightness;
|
|
35
|
+
uniform float uPointSize;
|
|
36
|
+
varying float vB;
|
|
37
|
+
void main() {
|
|
38
|
+
vB = aBrightness;
|
|
39
|
+
vec4 mv = modelViewMatrix * vec4(position, 1.0);
|
|
40
|
+
gl_PointSize = uPointSize * aBrightness * (200.0 / -mv.z);
|
|
41
|
+
gl_Position = projectionMatrix * mv;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const glowFrag = /* glsl */ `
|
|
45
|
+
uniform vec3 uColor;
|
|
46
|
+
uniform float uOpacity;
|
|
47
|
+
varying float vB;
|
|
48
|
+
void main() {
|
|
49
|
+
if (vB < 0.01) discard;
|
|
50
|
+
vec2 c = gl_PointCoord - 0.5;
|
|
51
|
+
if (length(c) > 0.5) discard;
|
|
52
|
+
float g = exp(-dot(c, c) * 5.5);
|
|
53
|
+
gl_FragColor = vec4(uColor, g * vB * uOpacity);
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const FADE_DUR = 0.22;
|
|
57
|
+
const LightningEffect = ({ boundingRadius, config, animations }) => {
|
|
58
|
+
const { boltCount, branchDepth, color, glowColor, opacity, speed, intensity, strikeRadius } = config;
|
|
59
|
+
const startValuesCacheRef = useRef({});
|
|
60
|
+
const depth = Math.min(Math.max(branchDepth, 2), 6);
|
|
61
|
+
const N = Math.pow(2, depth) + 1; // vertex count: 5, 9, 17, 33, 65
|
|
62
|
+
const coreCol = useMemo(() => new THREE.Color(color), [color]);
|
|
63
|
+
const glowCol = useMemo(() => new THREE.Color(glowColor), [glowColor]);
|
|
64
|
+
const glowVec = useMemo(() => new THREE.Vector3(glowCol.r, glowCol.g, glowCol.b), [glowCol]);
|
|
65
|
+
const sr = boundingRadius * strikeRadius;
|
|
66
|
+
// ── Compute origin/target for a bolt from a seed ───────────────────────────
|
|
67
|
+
function boltEndpoints(rng) {
|
|
68
|
+
const theta = rng() * Math.PI * 2;
|
|
69
|
+
const elev = 0.3 + rng() * 0.4; // horizontal spread of origin
|
|
70
|
+
return [
|
|
71
|
+
new THREE.Vector3(Math.cos(theta) * sr * elev, sr * (0.8 + rng() * 0.4), Math.sin(theta) * sr * elev),
|
|
72
|
+
new THREE.Vector3((rng() - 0.5) * boundingRadius * 0.4, (rng() - 0.5) * boundingRadius * 0.3, (rng() - 0.5) * boundingRadius * 0.4),
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
// ── Build line+point geometry from a point list ────────────────────────────
|
|
76
|
+
function makeGeos(pts, colBuf, brightBuf) {
|
|
77
|
+
const posArr = new Float32Array(N * 3);
|
|
78
|
+
for (let i = 0; i < pts.length && i < N; i++) {
|
|
79
|
+
posArr[i * 3] = pts[i].x;
|
|
80
|
+
posArr[i * 3 + 1] = pts[i].y;
|
|
81
|
+
posArr[i * 3 + 2] = pts[i].z;
|
|
82
|
+
}
|
|
83
|
+
const lineGeo = new THREE.BufferGeometry();
|
|
84
|
+
lineGeo.setAttribute('position', new THREE.BufferAttribute(posArr.slice(), 3));
|
|
85
|
+
lineGeo.setAttribute('color', new THREE.BufferAttribute(colBuf, 3));
|
|
86
|
+
const pointGeo = new THREE.BufferGeometry();
|
|
87
|
+
pointGeo.setAttribute('position', new THREE.BufferAttribute(posArr.slice(), 3));
|
|
88
|
+
pointGeo.setAttribute('aBrightness', new THREE.BufferAttribute(brightBuf, 1));
|
|
89
|
+
return { lineGeo, pointGeo };
|
|
90
|
+
}
|
|
91
|
+
// ── Initialise bolts ───────────────────────────────────────────────────────
|
|
92
|
+
const bolts = useMemo(() => {
|
|
93
|
+
return Array.from({ length: boltCount }, (_, bi) => {
|
|
94
|
+
const seed = bi * 997 + 1;
|
|
95
|
+
const rng = makeRng(seed);
|
|
96
|
+
const [o, t] = boltEndpoints(rng);
|
|
97
|
+
const pts = fractalPolyline(o, t, depth, rng);
|
|
98
|
+
const col = new Float32Array(N * 3);
|
|
99
|
+
const bri = new Float32Array(N);
|
|
100
|
+
const { lineGeo, pointGeo } = makeGeos(pts, col, bri);
|
|
101
|
+
return {
|
|
102
|
+
phase: 'wait', timer: (bi / boltCount) * 1.8,
|
|
103
|
+
progress: 0, seed, waitDur: 0.5 + rng() * 1.0,
|
|
104
|
+
points: pts, colBuf: col, brightBuf: bri, lineGeo, pointGeo,
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
|
+
}, [boltCount, depth, N]);
|
|
109
|
+
// ── Shared materials ───────────────────────────────────────────────────────
|
|
110
|
+
const lineMat = useMemo(() => new THREE.LineBasicMaterial({
|
|
111
|
+
vertexColors: true,
|
|
112
|
+
transparent: true,
|
|
113
|
+
depthWrite: false,
|
|
114
|
+
blending: THREE.AdditiveBlending,
|
|
115
|
+
}), []);
|
|
116
|
+
const glowMats = useMemo(() => bolts.map(() => new THREE.ShaderMaterial({
|
|
117
|
+
vertexShader: glowVert,
|
|
118
|
+
fragmentShader: glowFrag,
|
|
119
|
+
uniforms: {
|
|
120
|
+
uPointSize: { value: 6 * intensity },
|
|
121
|
+
uColor: { value: glowVec },
|
|
122
|
+
uOpacity: { value: opacity * 0.12 },
|
|
123
|
+
},
|
|
124
|
+
transparent: true,
|
|
125
|
+
depthWrite: false,
|
|
126
|
+
blending: THREE.AdditiveBlending,
|
|
127
|
+
})),
|
|
128
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
129
|
+
[bolts, intensity, glowVec, opacity]);
|
|
130
|
+
// ── Recompute vertex colors from current progress ──────────────────────────
|
|
131
|
+
function refreshColors(bolt, overallScale) {
|
|
132
|
+
const { progress, points, colBuf, brightBuf, lineGeo, pointGeo } = bolt;
|
|
133
|
+
const n = points.length;
|
|
134
|
+
for (let i = 0; i < n; i++) {
|
|
135
|
+
const t = i / (n - 1);
|
|
136
|
+
if (t > progress + 0.001) {
|
|
137
|
+
// Not yet reached — keep black (invisible with additive blend)
|
|
138
|
+
colBuf[i * 3] = colBuf[i * 3 + 1] = colBuf[i * 3 + 2] = 0;
|
|
139
|
+
brightBuf[i] = 0;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const behind = progress - t; // 0 = at head
|
|
143
|
+
// Exponential trail: bright near head, fades behind
|
|
144
|
+
const trail = Math.exp(-behind * 7.0);
|
|
145
|
+
// Build-up: whole bolt intensifies as progress moves from 0→1
|
|
146
|
+
const buildUp = 0.3 + 0.7 * progress;
|
|
147
|
+
// Extra corona right at the head
|
|
148
|
+
const corona = Math.exp(-behind * behind * 220) * 3.0;
|
|
149
|
+
const totalBri = (trail * buildUp + corona) * intensity * overallScale;
|
|
150
|
+
// Color: glow color in body → core (white-ish) at head corona
|
|
151
|
+
const headMix = Math.min(1, corona * 0.5);
|
|
152
|
+
colBuf[i * 3] = (glowCol.r + (coreCol.r - glowCol.r) * headMix) * totalBri;
|
|
153
|
+
colBuf[i * 3 + 1] = (glowCol.g + (coreCol.g - glowCol.g) * headMix) * totalBri;
|
|
154
|
+
colBuf[i * 3 + 2] = (glowCol.b + (coreCol.b - glowCol.b) * headMix) * totalBri;
|
|
155
|
+
brightBuf[i] = Math.min(1, (trail * buildUp * 0.5 + corona * 0.3) * overallScale);
|
|
156
|
+
}
|
|
157
|
+
lineGeo.attributes.color.needsUpdate = true;
|
|
158
|
+
pointGeo.attributes.aBrightness.needsUpdate = true;
|
|
159
|
+
}
|
|
160
|
+
// ── Rebuild bolt shape with fresh fractal ─────────────────────────────────
|
|
161
|
+
function rebuildShape(bolt) {
|
|
162
|
+
bolt.seed++;
|
|
163
|
+
const rng = makeRng(bolt.seed);
|
|
164
|
+
const [o, t] = boltEndpoints(rng);
|
|
165
|
+
bolt.points = fractalPolyline(o, t, depth, rng);
|
|
166
|
+
bolt.waitDur = 0.3 + rng() * 1.3;
|
|
167
|
+
bolt.progress = 0;
|
|
168
|
+
const pts = bolt.points;
|
|
169
|
+
const posL = bolt.lineGeo.attributes.position;
|
|
170
|
+
const posP = bolt.pointGeo.attributes.position;
|
|
171
|
+
for (let i = 0; i < pts.length && i < N; i++) {
|
|
172
|
+
posL.setXYZ(i, pts[i].x, pts[i].y, pts[i].z);
|
|
173
|
+
posP.setXYZ(i, pts[i].x, pts[i].y, pts[i].z);
|
|
174
|
+
}
|
|
175
|
+
posL.needsUpdate = true;
|
|
176
|
+
posP.needsUpdate = true;
|
|
177
|
+
}
|
|
178
|
+
useFrame((_, delta) => {
|
|
179
|
+
const dt = delta * speed;
|
|
180
|
+
bolts.forEach((bolt, bi) => {
|
|
181
|
+
switch (bolt.phase) {
|
|
182
|
+
case 'wait':
|
|
183
|
+
bolt.timer -= delta;
|
|
184
|
+
// Keep all colors black during wait
|
|
185
|
+
bolt.colBuf.fill(0);
|
|
186
|
+
bolt.brightBuf.fill(0);
|
|
187
|
+
bolt.lineGeo.attributes.color.needsUpdate = true;
|
|
188
|
+
bolt.pointGeo.attributes.aBrightness.needsUpdate = true;
|
|
189
|
+
if (bolt.timer <= 0) {
|
|
190
|
+
rebuildShape(bolt);
|
|
191
|
+
bolt.phase = 'travel';
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
case 'travel':
|
|
195
|
+
bolt.progress += dt * 8.0;
|
|
196
|
+
if (bolt.progress >= 1) {
|
|
197
|
+
bolt.progress = 1;
|
|
198
|
+
bolt.phase = 'flash';
|
|
199
|
+
bolt.timer = 0.06 + Math.random() * 0.05;
|
|
200
|
+
}
|
|
201
|
+
refreshColors(bolt, 1.0);
|
|
202
|
+
break;
|
|
203
|
+
case 'flash': {
|
|
204
|
+
bolt.timer -= delta;
|
|
205
|
+
// Flash: briefly crank overall brightness to 2–3x for the "return stroke"
|
|
206
|
+
const flashBoost = 1.0 + Math.max(0, bolt.timer / 0.08) * 2.5;
|
|
207
|
+
refreshColors(bolt, flashBoost);
|
|
208
|
+
if (bolt.timer <= 0) {
|
|
209
|
+
bolt.phase = 'fade';
|
|
210
|
+
bolt.timer = FADE_DUR;
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case 'fade': {
|
|
215
|
+
bolt.timer -= delta;
|
|
216
|
+
const ratio = Math.max(0, bolt.timer / FADE_DUR);
|
|
217
|
+
// Recompute full-progress colors then scale uniformly to fade out
|
|
218
|
+
refreshColors(bolt, ratio);
|
|
219
|
+
glowMats[bi].uniforms.uOpacity.value = opacity * 0.12 * ratio;
|
|
220
|
+
if (bolt.timer <= 0) {
|
|
221
|
+
bolt.phase = 'wait';
|
|
222
|
+
bolt.timer = bolt.waitDur;
|
|
223
|
+
glowMats[bi].uniforms.uOpacity.value = opacity * 0.12;
|
|
224
|
+
}
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
if (animations?.length) {
|
|
230
|
+
applyGenerativeAnimations(glowMats, animations, startValuesCacheRef.current, Date.now(), false);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
// ── Render ─────────────────────────────────────────────────────────────────
|
|
234
|
+
// Use primitive to render THREE.Line (not THREE.LineSegments)
|
|
235
|
+
const lineObjects = useMemo(() => bolts.map(bolt => new THREE.Line(bolt.lineGeo, lineMat)),
|
|
236
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
237
|
+
[bolts, lineMat]);
|
|
238
|
+
return (_jsx("group", { children: lineObjects.map((lineObj, bi) => (_jsxs("group", { children: [_jsx("primitive", { object: lineObj }), _jsx("points", { geometry: bolts[bi].pointGeo, material: glowMats[bi] })] }, bi))) }));
|
|
239
|
+
};
|
|
240
|
+
export default LightningEffect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MoleculesConfig, AnimationOptions } from '@3driseai/3drise-core';
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface MoleculesEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: MoleculesConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const MoleculesEffect: React.FC<MoleculesEffectProps>;
|
|
9
|
+
export default MoleculesEffect;
|
|
10
|
+
//# sourceMappingURL=MoleculesEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoleculesEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MoleculesEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,UAAU,oBAAoB;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC;AA+CD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAyHnD,CAAC;AACF,eAAe,eAAe,CAAC"}
|