@ntalmagor/3drize-viewer 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AnimatedObject.d.ts +22 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -0
- package/dist/components/AnimatedObject.js +121 -0
- package/dist/components/CameraController.d.ts +16 -0
- package/dist/components/CameraController.d.ts.map +1 -0
- package/dist/components/CameraController.js +132 -0
- package/dist/components/Clouds.d.ts +14 -0
- package/dist/components/Clouds.d.ts.map +1 -0
- package/dist/components/Clouds.js +97 -0
- package/dist/components/CreatedObject.d.ts +12 -0
- package/dist/components/CreatedObject.d.ts.map +1 -0
- package/dist/components/CreatedObject.js +139 -0
- package/dist/components/CustomPrimitive.d.ts +12 -0
- package/dist/components/CustomPrimitive.d.ts.map +1 -0
- package/dist/components/CustomPrimitive.js +80 -0
- package/dist/components/EffectsGenerator.d.ts +10 -0
- package/dist/components/EffectsGenerator.d.ts.map +1 -0
- package/dist/components/EffectsGenerator.js +59 -0
- package/dist/components/EffectsGroup.d.ts +8 -0
- package/dist/components/EffectsGroup.d.ts.map +1 -0
- package/dist/components/EffectsGroup.js +8 -0
- package/dist/components/EnvironmentManager.d.ts +9 -0
- package/dist/components/EnvironmentManager.d.ts.map +1 -0
- package/dist/components/EnvironmentManager.js +47 -0
- package/dist/components/Frame.d.ts +26 -0
- package/dist/components/Frame.d.ts.map +1 -0
- package/dist/components/Frame.js +50 -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 +14 -0
- package/dist/components/FrameImage.d.ts.map +1 -0
- package/dist/components/FrameImage.js +15 -0
- package/dist/components/Galaxy.d.ts +8 -0
- package/dist/components/Galaxy.d.ts.map +1 -0
- package/dist/components/Galaxy.js +9 -0
- package/dist/components/GalleryLayout.d.ts +10 -0
- package/dist/components/GalleryLayout.d.ts.map +1 -0
- package/dist/components/GalleryLayout.js +18 -0
- package/dist/components/GridHelper.d.ts +23 -0
- package/dist/components/GridHelper.d.ts.map +1 -0
- package/dist/components/GridHelper.js +38 -0
- package/dist/components/ImageGeometry.d.ts +14 -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 +20 -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/LightsManager.d.ts +9 -0
- package/dist/components/LightsManager.d.ts.map +1 -0
- package/dist/components/LightsManager.js +121 -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 +143 -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 +52 -0
- package/dist/components/ObjectNode.d.ts +11 -0
- package/dist/components/ObjectNode.d.ts.map +1 -0
- package/dist/components/ObjectNode.js +61 -0
- package/dist/components/ObjectsRenderer.d.ts +11 -0
- package/dist/components/ObjectsRenderer.d.ts.map +1 -0
- package/dist/components/ObjectsRenderer.js +19 -0
- package/dist/components/Ocean.d.ts +8 -0
- package/dist/components/Ocean.d.ts.map +1 -0
- package/dist/components/Ocean.js +111 -0
- package/dist/components/ParticlesR3f.d.ts +16 -0
- package/dist/components/ParticlesR3f.d.ts.map +1 -0
- package/dist/components/ParticlesR3f.js +66 -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 +14 -0
- package/dist/components/PathRenderer.d.ts.map +1 -0
- package/dist/components/PathRenderer.js +33 -0
- package/dist/components/ProductionScene.d.ts +29 -0
- package/dist/components/ProductionScene.d.ts.map +1 -0
- package/dist/components/ProductionScene.js +18 -0
- package/dist/components/ProjectLoader.d.ts +14 -0
- package/dist/components/ProjectLoader.d.ts.map +1 -0
- package/dist/components/ProjectLoader.js +76 -0
- package/dist/components/Rain.d.ts +8 -0
- package/dist/components/Rain.d.ts.map +1 -0
- package/dist/components/Rain.js +133 -0
- package/dist/components/SceneBuilder.d.ts +5 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -0
- package/dist/components/SceneBuilder.js +104 -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/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 +40 -0
- package/dist/components/SkyController.d.ts +10 -0
- package/dist/components/SkyController.d.ts.map +1 -0
- package/dist/components/SkyController.js +159 -0
- package/dist/components/SkyMesh.d.ts +11 -0
- package/dist/components/SkyMesh.d.ts.map +1 -0
- package/dist/components/SkyMesh.js +36 -0
- package/dist/components/SkySystem.d.ts +34 -0
- package/dist/components/SkySystem.d.ts.map +1 -0
- package/dist/components/SkySystem.js +47 -0
- package/dist/components/Skybox.d.ts +12 -0
- package/dist/components/Skybox.d.ts.map +1 -0
- package/dist/components/Skybox.js +79 -0
- package/dist/components/Stars.d.ts +14 -0
- package/dist/components/Stars.d.ts.map +1 -0
- package/dist/components/Stars.js +165 -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/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/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 +179 -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 +159 -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/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/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +1 -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/useAnimationEvents.d.ts +10 -0
- package/dist/hooks/useAnimationEvents.d.ts.map +1 -0
- package/dist/hooks/useAnimationEvents.js +28 -0
- package/dist/hooks/useCameraAnimation.d.ts +35 -0
- package/dist/hooks/useCameraAnimation.d.ts.map +1 -0
- package/dist/hooks/useCameraAnimation.js +268 -0
- package/dist/hooks/useContinuousEffects.d.ts +15 -0
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -0
- package/dist/hooks/useContinuousEffects.js +173 -0
- package/dist/hooks/useCubeCamera.d.ts +19 -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/useFrameEffects.d.ts +6 -0
- package/dist/hooks/useFrameEffects.d.ts.map +1 -0
- package/dist/hooks/useFrameEffects.js +19 -0
- package/dist/hooks/useInteractionEffects.d.ts +11 -0
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -0
- package/dist/hooks/useInteractionEffects.js +35 -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/useLightHandlers.d.ts +14 -0
- package/dist/hooks/useLightHandlers.d.ts.map +1 -0
- package/dist/hooks/useLightHandlers.js +116 -0
- package/dist/hooks/useMaterialApplication.d.ts +9 -0
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -0
- package/dist/hooks/useMaterialApplication.js +113 -0
- package/dist/hooks/useMaterialOptions.d.ts +13 -0
- package/dist/hooks/useMaterialOptions.d.ts.map +1 -0
- package/dist/hooks/useMaterialOptions.js +110 -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 +152 -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/useObjectAnimation.d.ts +13 -0
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -0
- package/dist/hooks/useObjectAnimation.js +11 -0
- package/dist/hooks/useObjectEdges.d.ts +4 -0
- package/dist/hooks/useObjectEdges.d.ts.map +1 -0
- package/dist/hooks/useObjectEdges.js +199 -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/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 +120 -0
- package/dist/hooks/useSkyAnimation.d.ts +14 -0
- package/dist/hooks/useSkyAnimation.d.ts.map +1 -0
- package/dist/hooks/useSkyAnimation.js +46 -0
- package/dist/hooks/useSkySystem.d.ts +26 -0
- package/dist/hooks/useSkySystem.d.ts.map +1 -0
- package/dist/hooks/useSkySystem.js +57 -0
- package/dist/hooks/useSkyUniforms.d.ts +18 -0
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -0
- package/dist/hooks/useSkyUniforms.js +59 -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/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 +17 -0
- package/dist/hooks/useWaterReflections.d.ts.map +1 -0
- package/dist/hooks/useWaterReflections.js +77 -0
- package/dist/index.d.ts +140 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -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 +279 -0
- package/dist/shaders/ShaderEffectsMaterial.d.ts.map +1 -0
- package/dist/shaders/ShaderEffectsMaterial.js +257 -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 +167 -0
- package/dist/utils/CameraSingleton.d.ts +35 -0
- package/dist/utils/CameraSingleton.d.ts.map +1 -0
- package/dist/utils/CameraSingleton.js +178 -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/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/particleAnimations.d.ts +3 -0
- package/dist/utils/particleAnimations.d.ts.map +1 -0
- package/dist/utils/particleAnimations.js +17 -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 +145 -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 +43 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextSettings } from '@ntalmagor/3drize-core';
|
|
3
|
+
export interface Text2DProps {
|
|
4
|
+
textSettings: TextSettings;
|
|
5
|
+
onTextClick?: (textSettings: TextSettings) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const Text2D: React.FC<Text2DProps>;
|
|
8
|
+
export default Text2D;
|
|
9
|
+
//# sourceMappingURL=Text2D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text2D.d.ts","sourceRoot":"","sources":["../../src/components/Text2D.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAItE,OAAO,KAAK,EAAE,YAAY,EAA4C,MAAM,wBAAwB,CAAC;AAKrG,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CACpD;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAyGjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import { Text, useCursor } from '@react-three/drei';
|
|
5
|
+
import { createDefaultEffectState, applyTransformEffects } from '@ntalmagor/3drize-core';
|
|
6
|
+
import { fontManager } from '../../../core/src/services/FontManager';
|
|
7
|
+
import { getTextEffectProps } from '../utils/textEffects';
|
|
8
|
+
const Text2D = ({ textSettings, onTextClick }) => {
|
|
9
|
+
const groupRef = useRef(null);
|
|
10
|
+
const textRef = useRef(null);
|
|
11
|
+
const [hovered, setHovered] = useState(false);
|
|
12
|
+
const [clicked, setClicked] = useState(false);
|
|
13
|
+
const effectStateRef = useRef(null);
|
|
14
|
+
const { config, materialSettings } = textSettings;
|
|
15
|
+
const text2DConfig = config;
|
|
16
|
+
const { text } = text2DConfig;
|
|
17
|
+
const { fontSize = 0.5, lineHeight = 1.2, letterSpacing = 0, textAlign = 'center', anchorX = 'center', anchorY = 'middle', font, maxWidth, } = text2DConfig;
|
|
18
|
+
const fontInfo = font ? fontManager.getFont(font) : null;
|
|
19
|
+
const fontUrl = fontInfo?.googleFont;
|
|
20
|
+
const color = 'color' in materialSettings ? materialSettings.color : '#ffffff';
|
|
21
|
+
const opacity = 'opacity' in materialSettings ? materialSettings.opacity : 1;
|
|
22
|
+
const transformEffects = textSettings.animations?.transform?.effects || [];
|
|
23
|
+
const defaultHoverSettings = { sensitivity: 0.5, applyToChildren: true };
|
|
24
|
+
const { sensitivity = 0.5 } = defaultHoverSettings;
|
|
25
|
+
useCursor(hovered);
|
|
26
|
+
const handlePointerEnter = useCallback((e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
setHovered(true);
|
|
29
|
+
}, []);
|
|
30
|
+
const handlePointerLeave = useCallback(() => {
|
|
31
|
+
setHovered(false);
|
|
32
|
+
}, []);
|
|
33
|
+
const handleClick = useCallback((e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
onTextClick?.(textSettings);
|
|
36
|
+
}, [onTextClick, textSettings]);
|
|
37
|
+
useFrame((state, dt) => {
|
|
38
|
+
if (!groupRef.current)
|
|
39
|
+
return;
|
|
40
|
+
const time = state.clock.elapsedTime;
|
|
41
|
+
if (!effectStateRef.current) {
|
|
42
|
+
effectStateRef.current = createDefaultEffectState(groupRef.current);
|
|
43
|
+
}
|
|
44
|
+
if (transformEffects.length > 0) {
|
|
45
|
+
const enabledEffects = transformEffects.filter(e => e.enabled !== false);
|
|
46
|
+
if (enabledEffects.length > 0) {
|
|
47
|
+
applyTransformEffects(groupRef.current, enabledEffects, time, dt, effectStateRef.current, hovered, clicked, sensitivity);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const hasFadeEffect = transformEffects.some(e => e.type === 'fade' && e.enabled !== false);
|
|
52
|
+
const finalOpacity = hasFadeEffect ? opacity : opacity;
|
|
53
|
+
const effectProps = useMemo(() => getTextEffectProps([]), []);
|
|
54
|
+
return (_jsx("group", { ref: groupRef, name: `text2d-${textSettings.name}`, userData: { textSettings }, children: _jsx(Text, { ref: textRef, fontSize: fontSize, color: color, maxWidth: maxWidth, lineHeight: lineHeight, letterSpacing: letterSpacing, textAlign: textAlign, anchorX: anchorX, anchorY: anchorY, font: fontUrl || undefined, fillOpacity: finalOpacity, onPointerEnter: handlePointerEnter, onPointerLeave: handlePointerLeave, onClick: handleClick, ...effectProps, children: text }) }));
|
|
55
|
+
};
|
|
56
|
+
export default Text2D;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextSettings } from '@ntalmagor/3drize-core';
|
|
3
|
+
import type { LetterData } from './Letter';
|
|
4
|
+
export interface Text3DProps {
|
|
5
|
+
textSettings: TextSettings;
|
|
6
|
+
onLetterClick?: (letterData: LetterData) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const Text3D: React.FC<Text3DProps>;
|
|
9
|
+
export default Text3D;
|
|
10
|
+
//# sourceMappingURL=Text3D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text3D.d.ts","sourceRoot":"","sources":["../../src/components/Text3D.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;CAClD;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAcjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Letters from './Letters';
|
|
3
|
+
const Text3D = ({ textSettings, onLetterClick }) => {
|
|
4
|
+
const { config, materialSettings } = textSettings;
|
|
5
|
+
const { text } = config;
|
|
6
|
+
return (_jsx(Letters, { text: text, config: config, materialSettings: materialSettings, hoverSettings: { sensitivity: 0.5, applyToChildren: false }, transformEffects: textSettings.animations?.transform?.effects || [], onLetterClick: onLetterClick }));
|
|
7
|
+
};
|
|
8
|
+
export default Text3D;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AuraConfig, AnimationOptions } from '@ntalmagor/3drize-core';
|
|
3
|
+
interface AuraEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: AuraConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const AuraEffect: React.FC<AuraEffectProps>;
|
|
9
|
+
export default AuraEffect;
|
|
10
|
+
//# sourceMappingURL=AuraEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuraEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/AuraEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI3E,UAAU,eAAe;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAiFD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4DzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
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';
|
|
6
|
+
const vertexShader = /* glsl */ `
|
|
7
|
+
varying vec3 vNormal;
|
|
8
|
+
varying vec3 vViewDir;
|
|
9
|
+
varying vec3 vWorldNormal;
|
|
10
|
+
|
|
11
|
+
void main() {
|
|
12
|
+
vNormal = normalize(normalMatrix * normal);
|
|
13
|
+
vWorldNormal = normalize((modelMatrix * vec4(normal, 0.0)).xyz);
|
|
14
|
+
vec4 mv = modelViewMatrix * vec4(position, 1.0);
|
|
15
|
+
vViewDir = normalize(-mv.xyz);
|
|
16
|
+
gl_Position = projectionMatrix * mv;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
const fragmentShader = /* glsl */ `
|
|
20
|
+
uniform float u_time;
|
|
21
|
+
uniform float uFresnelPower;
|
|
22
|
+
uniform float uPulseSpeed;
|
|
23
|
+
uniform float uNoiseAmount;
|
|
24
|
+
uniform float uOpacity;
|
|
25
|
+
uniform float uLayerIndex; // 0..1
|
|
26
|
+
uniform float uBaseHue;
|
|
27
|
+
uniform float uIntensity;
|
|
28
|
+
|
|
29
|
+
varying vec3 vNormal;
|
|
30
|
+
varying vec3 vViewDir;
|
|
31
|
+
varying vec3 vWorldNormal;
|
|
32
|
+
|
|
33
|
+
// ── HSV helper ────────────────────────────────────────────────────────────
|
|
34
|
+
vec3 hsv2rgb(float h, float s, float v) {
|
|
35
|
+
vec3 rgb = clamp(abs(mod(h*6.0+vec3(0.,4.,2.),6.)-3.)-1.,0.,1.);
|
|
36
|
+
return v * mix(vec3(1.0), rgb, s);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ── 3D value noise + 4-octave FBM ─────────────────────────────────────────
|
|
40
|
+
float hash(vec3 p){ return fract(sin(dot(p,vec3(127.1,311.7,74.7)))*43758.5453); }
|
|
41
|
+
float noise(vec3 p){
|
|
42
|
+
vec3 i=floor(p); vec3 f=fract(p); f=f*f*(3.-2.*f);
|
|
43
|
+
return mix(mix(mix(hash(i), hash(i+vec3(1,0,0)),f.x),
|
|
44
|
+
mix(hash(i+vec3(0,1,0)),hash(i+vec3(1,1,0)),f.x),f.y),
|
|
45
|
+
mix(mix(hash(i+vec3(0,0,1)),hash(i+vec3(1,0,1)),f.x),
|
|
46
|
+
mix(hash(i+vec3(0,1,1)),hash(i+vec3(1,1,1)),f.x),f.y),f.z);
|
|
47
|
+
}
|
|
48
|
+
float fbm(vec3 p){
|
|
49
|
+
float v=0., a=0.5;
|
|
50
|
+
for(int i=0;i<4;i++){ v+=a*noise(p); p=p*2.17+vec3(1.7,9.2,3.7); a*=0.5; }
|
|
51
|
+
return v;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void main() {
|
|
55
|
+
vec3 viewDir = normalize(vViewDir);
|
|
56
|
+
|
|
57
|
+
// ── Fresnel ────────────────────────────────────────────────────────────
|
|
58
|
+
float ndv = abs(dot(vNormal, viewDir));
|
|
59
|
+
float fresnel = pow(1.0 - ndv, uFresnelPower);
|
|
60
|
+
|
|
61
|
+
// ── 4-octave FBM noise ─────────────────────────────────────────────────
|
|
62
|
+
float f = fbm(vWorldNormal * 3.5 + u_time * 0.18);
|
|
63
|
+
|
|
64
|
+
// ── Iridescence: hue shifts with view angle AND time ───────────────────
|
|
65
|
+
float hue = mod(uBaseHue + ndv * 0.45 - uLayerIndex * 0.15 + u_time * 0.04, 1.0);
|
|
66
|
+
vec3 iriCol = hsv2rgb(hue, 0.85, 1.0);
|
|
67
|
+
|
|
68
|
+
// ── Electric tendrils: sharp bright streaks where FBM exceeds threshold ─
|
|
69
|
+
float tendrils = smoothstep(0.60, 0.75, f + uLayerIndex * 0.05);
|
|
70
|
+
|
|
71
|
+
// ── Pulse per layer (staggered phase) ──────────────────────────────────
|
|
72
|
+
float pulse = 0.65 + 0.35 * sin(u_time * uPulseSpeed + uLayerIndex * 2.1);
|
|
73
|
+
|
|
74
|
+
// ── Combine ────────────────────────────────────────────────────────────
|
|
75
|
+
float noiseBlend = (1.0 - uNoiseAmount) + uNoiseAmount * f;
|
|
76
|
+
float alpha = fresnel * noiseBlend * uOpacity * pulse * (1.0 - uLayerIndex * 0.22) * uIntensity;
|
|
77
|
+
if (alpha < 0.004) discard;
|
|
78
|
+
|
|
79
|
+
vec3 col = iriCol + iriCol * tendrils * 1.8;
|
|
80
|
+
gl_FragColor = vec4(col, alpha);
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
const AuraEffect = ({ boundingRadius, config, animations }) => {
|
|
84
|
+
const { layerCount, fresnelPower, pulseSpeed, innerColor, outerColor, noiseAmount, sizeMultiplier, opacity, speed, intensity } = config;
|
|
85
|
+
const startValuesCacheRef = useRef({});
|
|
86
|
+
// Derive a single base hue from the innerColor
|
|
87
|
+
const baseHue = useMemo(() => {
|
|
88
|
+
const c = new THREE.Color(innerColor);
|
|
89
|
+
const h = { h: 0, s: 0, l: 0 };
|
|
90
|
+
c.getHSL(h);
|
|
91
|
+
return h.h;
|
|
92
|
+
}, [innerColor]);
|
|
93
|
+
const materials = useMemo(() => Array.from({ length: layerCount }, (_, i) => new THREE.ShaderMaterial({
|
|
94
|
+
vertexShader,
|
|
95
|
+
fragmentShader,
|
|
96
|
+
uniforms: {
|
|
97
|
+
u_time: { value: 0 },
|
|
98
|
+
uFresnelPower: { value: fresnelPower },
|
|
99
|
+
uPulseSpeed: { value: pulseSpeed * speed },
|
|
100
|
+
uNoiseAmount: { value: noiseAmount },
|
|
101
|
+
uOpacity: { value: opacity },
|
|
102
|
+
uLayerIndex: { value: layerCount > 1 ? i / (layerCount - 1) : 0 },
|
|
103
|
+
uBaseHue: { value: baseHue },
|
|
104
|
+
uIntensity: { value: intensity },
|
|
105
|
+
},
|
|
106
|
+
transparent: true,
|
|
107
|
+
depthWrite: false,
|
|
108
|
+
blending: THREE.AdditiveBlending,
|
|
109
|
+
side: THREE.BackSide,
|
|
110
|
+
})), [layerCount, fresnelPower, pulseSpeed, speed, noiseAmount, opacity, baseHue, intensity]);
|
|
111
|
+
useFrame((state) => {
|
|
112
|
+
const t = state.clock.getElapsedTime();
|
|
113
|
+
for (const mat of materials)
|
|
114
|
+
mat.uniforms.u_time.value = t;
|
|
115
|
+
if (animations?.length) {
|
|
116
|
+
applyGenerativeAnimations(materials, animations, startValuesCacheRef.current, Date.now(), false);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const baseR = boundingRadius * sizeMultiplier;
|
|
120
|
+
return (_jsx("group", { children: Array.from({ length: layerCount }, (_, i) => {
|
|
121
|
+
// Non-linear layer spacing: outer layers spread wider
|
|
122
|
+
const layerT = layerCount > 1 ? i / (layerCount - 1) : 0;
|
|
123
|
+
const r = baseR * (1 + layerT * layerT * 0.5);
|
|
124
|
+
return (_jsx("mesh", { material: materials[i], children: _jsx("sphereGeometry", { args: [r, 40, 40] }) }, i));
|
|
125
|
+
}) }));
|
|
126
|
+
};
|
|
127
|
+
export default AuraEffect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AuroraConfig, AnimationOptions } from '@ntalmagor/3drize-core';
|
|
3
|
+
interface AuroraEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: AuroraConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const AuroraEffect: React.FC<AuroraEffectProps>;
|
|
9
|
+
export default AuroraEffect;
|
|
10
|
+
//# sourceMappingURL=AuroraEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuroraEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/AuroraEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI7E,UAAU,iBAAiB;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAsDD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0E7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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';
|
|
6
|
+
const ribbonVert = /* glsl */ `
|
|
7
|
+
uniform float u_time;
|
|
8
|
+
uniform float uPhase;
|
|
9
|
+
uniform float u_speed;
|
|
10
|
+
uniform float uWaveAmp;
|
|
11
|
+
varying vec2 vUv;
|
|
12
|
+
|
|
13
|
+
void main() {
|
|
14
|
+
vec3 pos = position;
|
|
15
|
+
float w1 = sin(pos.y * 2.5 + u_time * u_speed + uPhase) * uWaveAmp;
|
|
16
|
+
float w2 = sin(pos.y * 1.2 - u_time * u_speed * 0.7 + uPhase * 1.3) * uWaveAmp * 0.5;
|
|
17
|
+
float w3 = sin(pos.y * 4.1 + u_time * u_speed * 1.3 + uPhase * 2.1) * uWaveAmp * 0.18;
|
|
18
|
+
pos.x += w1 + w2 + w3;
|
|
19
|
+
pos.z += sin(pos.y * 3.0 + u_time * u_speed * 0.5 + uPhase * 0.7) * uWaveAmp * 0.3;
|
|
20
|
+
vUv = uv;
|
|
21
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const ribbonFrag = /* glsl */ `
|
|
25
|
+
uniform float u_time;
|
|
26
|
+
uniform float uHue;
|
|
27
|
+
uniform float uOpacity;
|
|
28
|
+
uniform float uIntensity;
|
|
29
|
+
varying vec2 vUv;
|
|
30
|
+
|
|
31
|
+
vec3 hsl2rgb(float h, float s, float l) {
|
|
32
|
+
vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
|
|
33
|
+
return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void main() {
|
|
37
|
+
// Soft fade top and bottom
|
|
38
|
+
float fade = sin(vUv.y * 3.14159);
|
|
39
|
+
fade = pow(fade, 0.6); // bias toward middle
|
|
40
|
+
|
|
41
|
+
// Vertical shimmer bands (curtain rays)
|
|
42
|
+
float shimmer = 0.55 + 0.45 * sin(vUv.y * 22.0 + u_time * 2.4 + uHue * 9.0);
|
|
43
|
+
|
|
44
|
+
// Horizontal soft edge fade
|
|
45
|
+
float hEdge = smoothstep(0.0, 0.18, vUv.x) * smoothstep(1.0, 0.82, vUv.x);
|
|
46
|
+
|
|
47
|
+
// Color: hue drifts upward and over time
|
|
48
|
+
float hue = mod(uHue + vUv.y * 0.14 + u_time * 0.022, 1.0);
|
|
49
|
+
vec3 col = hsl2rgb(hue, 0.92, 0.58 + shimmer * 0.12);
|
|
50
|
+
|
|
51
|
+
float alpha = fade * shimmer * hEdge * uOpacity * uIntensity;
|
|
52
|
+
if (alpha < 0.005) discard;
|
|
53
|
+
gl_FragColor = vec4(col, alpha);
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const AuroraEffect = ({ boundingRadius, config, animations }) => {
|
|
57
|
+
const { ribbonCount, waveAmplitude, colorShift, arcWidth, opacity, speed, intensity } = config;
|
|
58
|
+
const groupRef = useRef(null);
|
|
59
|
+
const ribbons = useMemo(() => {
|
|
60
|
+
const N = Math.max(3, Math.min(ribbonCount, 10));
|
|
61
|
+
const r = boundingRadius;
|
|
62
|
+
const w = r * 0.9;
|
|
63
|
+
const h = r * 2.2;
|
|
64
|
+
const rad = r * 1.35;
|
|
65
|
+
// Aurora spectrum: green → teal → cyan → violet
|
|
66
|
+
const hues = [0.33, 0.38, 0.45, 0.50, 0.57, 0.65, 0.72, 0.78, 0.82, 0.87];
|
|
67
|
+
return Array.from({ length: N }, (_, i) => {
|
|
68
|
+
const t = N === 1 ? 0.5 : i / (N - 1);
|
|
69
|
+
const angle = (t - 0.5) * arcWidth * Math.PI; // spread across arc
|
|
70
|
+
const hue = (colorShift + hues[i % hues.length]) % 1;
|
|
71
|
+
const geo = new THREE.PlaneGeometry(w, h, 1, 24);
|
|
72
|
+
const mat = new THREE.ShaderMaterial({
|
|
73
|
+
vertexShader: ribbonVert,
|
|
74
|
+
fragmentShader: ribbonFrag,
|
|
75
|
+
uniforms: {
|
|
76
|
+
u_time: { value: 0 },
|
|
77
|
+
uPhase: { value: i * 1.13 + t * Math.PI * 2 },
|
|
78
|
+
u_speed: { value: 0.55 + Math.random() * 0.3 },
|
|
79
|
+
uWaveAmp: { value: waveAmplitude * r * 0.55 },
|
|
80
|
+
uHue: { value: hue },
|
|
81
|
+
uOpacity: { value: opacity },
|
|
82
|
+
uIntensity: { value: intensity },
|
|
83
|
+
},
|
|
84
|
+
transparent: true,
|
|
85
|
+
depthWrite: false,
|
|
86
|
+
blending: THREE.AdditiveBlending,
|
|
87
|
+
side: THREE.DoubleSide,
|
|
88
|
+
});
|
|
89
|
+
// Position ribbon in arc — tilted slightly inward to wrap over the object
|
|
90
|
+
const mesh = new THREE.Mesh(geo, mat);
|
|
91
|
+
mesh.position.set(Math.sin(angle) * rad, r * 0.55, // float above object
|
|
92
|
+
-Math.cos(angle) * rad);
|
|
93
|
+
mesh.rotation.y = angle; // face inward
|
|
94
|
+
mesh.rotation.x = 0.08; // slight forward tilt
|
|
95
|
+
return { mesh, mat };
|
|
96
|
+
});
|
|
97
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
+
}, [ribbonCount, waveAmplitude, colorShift, arcWidth, opacity, intensity, boundingRadius]);
|
|
99
|
+
const startValuesCacheRef = useRef({});
|
|
100
|
+
useFrame((state, delta) => {
|
|
101
|
+
if (!groupRef.current)
|
|
102
|
+
return;
|
|
103
|
+
const t = state.clock.getElapsedTime();
|
|
104
|
+
ribbons.forEach(({ mat }) => { mat.uniforms.u_time.value = t; });
|
|
105
|
+
groupRef.current.rotation.y += delta * speed * 0.06;
|
|
106
|
+
if (animations?.length) {
|
|
107
|
+
applyGenerativeAnimations(ribbons.map(({ mat }) => mat), animations, startValuesCacheRef.current, Date.now(), false);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return (_jsx("group", { ref: groupRef, children: ribbons.map(({ mesh }, i) => (_jsx("primitive", { object: mesh }, i))) }));
|
|
111
|
+
};
|
|
112
|
+
export default AuroraEffect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BlackHoleConfig, AnimationOptions } from '@ntalmagor/3drize-core';
|
|
3
|
+
interface BlackHoleEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: BlackHoleConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const BlackHoleEffect: React.FC<BlackHoleEffectProps>;
|
|
9
|
+
export default BlackHoleEffect;
|
|
10
|
+
//# sourceMappingURL=BlackHoleEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlackHoleEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/BlackHoleEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAIhF,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAwHD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkGnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, 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';
|
|
6
|
+
// ── Accretion disk shader ─────────────────────────────────────────────────────
|
|
7
|
+
const diskVert = /* glsl */ `
|
|
8
|
+
varying vec2 vUv;
|
|
9
|
+
void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); }
|
|
10
|
+
`;
|
|
11
|
+
const diskFrag = /* glsl */ `
|
|
12
|
+
uniform float u_time;
|
|
13
|
+
uniform float uRotSpeed;
|
|
14
|
+
uniform vec3 uDiskColor;
|
|
15
|
+
uniform float uOpacity;
|
|
16
|
+
uniform float uIntensity;
|
|
17
|
+
|
|
18
|
+
varying vec2 vUv;
|
|
19
|
+
|
|
20
|
+
vec3 tempColor(float t) {
|
|
21
|
+
// t=0 outer edge (cool red), t=1 inner edge (blue-white hot)
|
|
22
|
+
vec3 outer = uDiskColor * 0.4;
|
|
23
|
+
vec3 mid = uDiskColor;
|
|
24
|
+
vec3 inner = vec3(0.85, 0.95, 1.0) * 2.5;
|
|
25
|
+
if (t < 0.5) return mix(outer, mid, t * 2.0);
|
|
26
|
+
else return mix(mid, inner, (t - 0.5) * 2.0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
float hash(float n) { return fract(sin(n) * 43758.5453); }
|
|
30
|
+
|
|
31
|
+
void main() {
|
|
32
|
+
// Polar coordinates from ring UV
|
|
33
|
+
vec2 centered = vUv * 2.0 - 1.0;
|
|
34
|
+
float dist = length(centered);
|
|
35
|
+
if (dist > 1.0 || dist < 0.001) discard;
|
|
36
|
+
|
|
37
|
+
float angle = atan(centered.y, centered.x);
|
|
38
|
+
|
|
39
|
+
// Normalized radial position (0=inner, 1=outer)
|
|
40
|
+
float t = 1.0 - dist;
|
|
41
|
+
|
|
42
|
+
// Spiral motion bands
|
|
43
|
+
float spiral = fract(dist * 6.0 - u_time * uRotSpeed + angle / 6.28318);
|
|
44
|
+
float bands = pow(spiral, 2.2) * 0.6 + 0.4;
|
|
45
|
+
|
|
46
|
+
// Brightness: peaks near inner edge, falls off to rim
|
|
47
|
+
float bright = pow(t, 0.7) * bands;
|
|
48
|
+
|
|
49
|
+
// Fine-grained turbulence
|
|
50
|
+
float noise = 0.85 + 0.15 * sin(angle * 7.0 + dist * 18.0 - u_time * 2.5);
|
|
51
|
+
|
|
52
|
+
vec3 col = tempColor(t) * bright * noise;
|
|
53
|
+
float alpha = bright * noise * uOpacity * uIntensity * smoothstep(0.0, 0.08, dist);
|
|
54
|
+
if (alpha < 0.005) discard;
|
|
55
|
+
gl_FragColor = vec4(col, alpha);
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
// ── Photon sphere (lensing rim) ───────────────────────────────────────────────
|
|
59
|
+
const lensFrag = /* glsl */ `
|
|
60
|
+
uniform float u_time;
|
|
61
|
+
uniform vec3 uDiskColor;
|
|
62
|
+
uniform float uOpacity;
|
|
63
|
+
uniform float uIntensity;
|
|
64
|
+
varying vec3 vNormal;
|
|
65
|
+
|
|
66
|
+
void main() {
|
|
67
|
+
vec3 viewDir = normalize(cameraPosition - vNormal * 100.0);
|
|
68
|
+
float ndv = abs(dot(normalize(vNormal), viewDir));
|
|
69
|
+
float fresnel = pow(1.0 - ndv, 2.2);
|
|
70
|
+
// Only show a bright equatorial band
|
|
71
|
+
float equator = exp(-ndv * ndv * 6.0) * 2.5;
|
|
72
|
+
float alpha = (fresnel * 0.4 + equator * 0.6) * uOpacity * uIntensity;
|
|
73
|
+
if (alpha < 0.005) discard;
|
|
74
|
+
vec3 col = mix(uDiskColor, vec3(1.0, 0.92, 0.8), fresnel * 0.5);
|
|
75
|
+
gl_FragColor = vec4(col, alpha);
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
const lensVert = /* glsl */ `
|
|
79
|
+
varying vec3 vNormal;
|
|
80
|
+
void main() {
|
|
81
|
+
vNormal = (modelMatrix * vec4(normal, 0.0)).xyz;
|
|
82
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
// ── Jet particle shader ───────────────────────────────────────────────────────
|
|
86
|
+
const jetVert = /* glsl */ `
|
|
87
|
+
attribute float aT;
|
|
88
|
+
attribute float aPhase;
|
|
89
|
+
uniform float u_time;
|
|
90
|
+
uniform float u_speed;
|
|
91
|
+
uniform float uLength;
|
|
92
|
+
uniform float uDir; // +1 or -1
|
|
93
|
+
uniform float uRadius;
|
|
94
|
+
varying float vT;
|
|
95
|
+
void main() {
|
|
96
|
+
float t = fract(aT + u_time * u_speed);
|
|
97
|
+
vT = t;
|
|
98
|
+
float r = uRadius * (1.0 - t * 0.85);
|
|
99
|
+
float a = aPhase + t * 4.0;
|
|
100
|
+
float x = cos(a) * r;
|
|
101
|
+
float z = sin(a) * r;
|
|
102
|
+
float y = uDir * t * uLength;
|
|
103
|
+
vec4 mv = modelViewMatrix * vec4(x, y, z, 1.0);
|
|
104
|
+
gl_PointSize = (1.0 - t) * 6.0 * (200.0 / -mv.z);
|
|
105
|
+
gl_Position = projectionMatrix * mv;
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
const jetFrag = /* glsl */ `
|
|
109
|
+
uniform vec3 uJetColor;
|
|
110
|
+
uniform float uOpacity;
|
|
111
|
+
varying float vT;
|
|
112
|
+
void main() {
|
|
113
|
+
vec2 c = gl_PointCoord - 0.5;
|
|
114
|
+
if (length(c) > 0.5) discard;
|
|
115
|
+
float g = exp(-dot(c,c) * 6.0);
|
|
116
|
+
float a = g * uOpacity * (1.0 - vT) * smoothstep(0.0, 0.1, vT);
|
|
117
|
+
if (a < 0.01) discard;
|
|
118
|
+
gl_FragColor = vec4(uJetColor, a);
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
const BlackHoleEffect = ({ boundingRadius, config, animations }) => {
|
|
122
|
+
const { diskColor, jetEnabled, jetColor, rotationSpeed, tilt, opacity, speed, intensity } = config;
|
|
123
|
+
const startValuesCacheRef = useRef({});
|
|
124
|
+
const groupRef = useRef(null);
|
|
125
|
+
const r = boundingRadius;
|
|
126
|
+
const { diskMat, lensMat, jetMat1, jetMat2, jetGeo } = useMemo(() => {
|
|
127
|
+
const dc = new THREE.Color(diskColor);
|
|
128
|
+
const dcv = new THREE.Vector3(dc.r, dc.g, dc.b);
|
|
129
|
+
const dMat = new THREE.ShaderMaterial({
|
|
130
|
+
vertexShader: diskVert, fragmentShader: diskFrag,
|
|
131
|
+
uniforms: {
|
|
132
|
+
u_time: { value: 0 },
|
|
133
|
+
uRotSpeed: { value: rotationSpeed },
|
|
134
|
+
uDiskColor: { value: dcv },
|
|
135
|
+
uOpacity: { value: opacity },
|
|
136
|
+
uIntensity: { value: intensity },
|
|
137
|
+
},
|
|
138
|
+
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide,
|
|
139
|
+
});
|
|
140
|
+
const lMat = new THREE.ShaderMaterial({
|
|
141
|
+
vertexShader: lensVert, fragmentShader: lensFrag,
|
|
142
|
+
uniforms: {
|
|
143
|
+
u_time: { value: 0 },
|
|
144
|
+
uDiskColor: { value: dcv },
|
|
145
|
+
uOpacity: { value: opacity },
|
|
146
|
+
uIntensity: { value: intensity },
|
|
147
|
+
},
|
|
148
|
+
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.BackSide,
|
|
149
|
+
});
|
|
150
|
+
// Jet geometry (shared, mirrored with uDir ±1)
|
|
151
|
+
const JN = 80;
|
|
152
|
+
const jT = new Float32Array(JN);
|
|
153
|
+
const jPhase = new Float32Array(JN);
|
|
154
|
+
for (let i = 0; i < JN; i++) {
|
|
155
|
+
jT[i] = i / JN;
|
|
156
|
+
jPhase[i] = Math.random() * Math.PI * 2;
|
|
157
|
+
}
|
|
158
|
+
const jGeo = new THREE.BufferGeometry();
|
|
159
|
+
jGeo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(JN * 3), 3));
|
|
160
|
+
jGeo.setAttribute('aT', new THREE.BufferAttribute(jT, 1));
|
|
161
|
+
jGeo.setAttribute('aPhase', new THREE.BufferAttribute(jPhase, 1));
|
|
162
|
+
jGeo.frustumCulled = false;
|
|
163
|
+
const jc = new THREE.Color(jetColor);
|
|
164
|
+
const makeJetMat = (dir) => new THREE.ShaderMaterial({
|
|
165
|
+
vertexShader: jetVert, fragmentShader: jetFrag,
|
|
166
|
+
uniforms: {
|
|
167
|
+
u_time: { value: 0 },
|
|
168
|
+
u_speed: { value: speed },
|
|
169
|
+
uLength: { value: r * 2.2 },
|
|
170
|
+
uDir: { value: dir },
|
|
171
|
+
uRadius: { value: r * 0.12 },
|
|
172
|
+
uJetColor: { value: new THREE.Vector3(jc.r, jc.g, jc.b) },
|
|
173
|
+
uOpacity: { value: opacity * 0.8 },
|
|
174
|
+
},
|
|
175
|
+
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
176
|
+
});
|
|
177
|
+
return { diskMat: dMat, lensMat: lMat, jetMat1: makeJetMat(1), jetMat2: makeJetMat(-1), jetGeo: jGeo };
|
|
178
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
|
+
}, [diskColor, jetColor, rotationSpeed, opacity, intensity, speed, r]);
|
|
180
|
+
useFrame((state) => {
|
|
181
|
+
const t = state.clock.getElapsedTime();
|
|
182
|
+
diskMat.uniforms.u_time.value = t;
|
|
183
|
+
lensMat.uniforms.u_time.value = t;
|
|
184
|
+
jetMat1.uniforms.u_time.value = t;
|
|
185
|
+
jetMat2.uniforms.u_time.value = t;
|
|
186
|
+
if (animations?.length) {
|
|
187
|
+
applyGenerativeAnimations([diskMat, lensMat, jetMat1, jetMat2], animations, startValuesCacheRef.current, Date.now(), false);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
const tiltRad = (tilt * Math.PI) / 180;
|
|
191
|
+
return (_jsxs("group", { ref: groupRef, rotation: [0, 0, tiltRad], children: [_jsx("mesh", { material: lensMat, children: _jsx("sphereGeometry", { args: [r * 0.55, 48, 48] }) }), _jsx("mesh", { material: diskMat, rotation: [Math.PI / 2, 0, 0], children: _jsx("ringGeometry", { args: [r * 0.38, r * 1.15, 72] }) }), jetEnabled && (_jsxs(_Fragment, { children: [_jsx("points", { geometry: jetGeo, material: jetMat1 }), _jsx("points", { geometry: jetGeo, material: jetMat2 })] }))] }));
|
|
192
|
+
};
|
|
193
|
+
export default BlackHoleEffect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConstellationConfig, AnimationOptions } from '@ntalmagor/3drize-core';
|
|
3
|
+
interface ConstellationEffectProps {
|
|
4
|
+
boundingRadius: number;
|
|
5
|
+
config: ConstellationConfig;
|
|
6
|
+
animations?: AnimationOptions[];
|
|
7
|
+
}
|
|
8
|
+
declare const ConstellationEffect: React.FC<ConstellationEffectProps>;
|
|
9
|
+
export default ConstellationEffect;
|
|
10
|
+
//# sourceMappingURL=ConstellationEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConstellationEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/ConstellationEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAIpF,UAAU,wBAAwB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAqGD,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA0G3D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|