@ntalmagor/3drize-viewer 0.1.16 → 0.1.17
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.map +1 -1
- package/dist/components/AnimatedObject.js +12 -74
- package/dist/components/CameraController.d.ts +1 -1
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +51 -14
- package/dist/components/Clouds.d.ts +2 -7
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +67 -3
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +7 -16
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +23 -16
- package/dist/components/Letter.js +1 -1
- package/dist/components/LoadingIndicator.d.ts +1 -1
- package/dist/components/LoadingIndicator.d.ts.map +1 -1
- package/dist/components/LoadingIndicator.js +1 -1
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +111 -67
- package/dist/components/ParticlesR3f.d.ts +0 -5
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/ParticlesR3f.js +41 -12
- package/dist/components/ProductionScene.d.ts.map +1 -1
- package/dist/components/ProductionScene.js +3 -5
- package/dist/components/Rain.js +1 -1
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +2 -2
- package/dist/components/ShootingStar.js +1 -1
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +27 -4
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +1 -1
- package/dist/components/Skybox.d.ts +1 -1
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +1 -1
- package/dist/components/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +43 -7
- 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/useContinuousEffects.js +1 -0
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
- package/dist/hooks/useInteractionEffects.js +10 -14
- package/dist/hooks/useMaterialApplication.d.ts +1 -6
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
- package/dist/hooks/useMaterialApplication.js +8 -37
- 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.js +1 -1
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
- package/dist/hooks/useSequenceAnimation.js +41 -68
- package/dist/hooks/useSkyAnimation.d.ts +8 -9
- package/dist/hooks/useSkyAnimation.d.ts.map +1 -1
- package/dist/hooks/useSkyAnimation.js +17 -27
- package/dist/hooks/useSkyUniforms.d.ts +1 -1
- package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
- package/dist/hooks/useSkyUniforms.js +20 -7
- package/dist/hooks/useWaterReflections.d.ts.map +1 -1
- package/dist/hooks/useWaterReflections.js +12 -5
- package/dist/index.d.ts +1 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -7
- package/dist/shaders/ShaderEffectsMaterial.d.ts +98 -150
- package/dist/shaders/ShaderEffectsMaterial.d.ts.map +1 -1
- package/dist/shaders/ShaderEffectsMaterial.js +216 -240
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts +1 -1
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.d.ts.map +1 -1
- package/dist/shaders/effects/EffectsVertexFunctions.glsl.js +93 -145
- 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/shaderUtils.d.ts.map +1 -1
- package/dist/utils/shaderUtils.js +98 -92
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedObject.d.ts","sourceRoot":"","sources":["../../src/components/AnimatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"AnimatedObject.d.ts","sourceRoot":"","sources":["../../src/components/AnimatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAMvG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,aAAa,EAAE,qBAAqB,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACjH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACvD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACvD,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAE3B;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuGvD,CAAC;AAGH,eAAe,cAAc,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useEffect, useCallback, memo } from 'react';
|
|
|
3
3
|
import { usePathAnimation } from '../hooks/usePathAnimation.js';
|
|
4
4
|
import EffectsGroup from './EffectsGroup.js';
|
|
5
5
|
import { useObjectAnimation } from '../hooks/useObjectAnimation.js';
|
|
6
|
+
import { hasHoverAnimation } from '../utils/hasHoverAnimation.js';
|
|
6
7
|
export const AnimatedObject = memo(({ stateKey, transitionSettings, createdObject,
|
|
7
8
|
// speed = 1,
|
|
8
9
|
visible = true, children, parentRef, handleObjectClick, onPointerEnter, onPointerLeave, anchor, hovered = false, animateMaterial = true,
|
|
@@ -15,6 +16,8 @@ visible = true, children, parentRef, handleObjectClick, onPointerEnter, onPointe
|
|
|
15
16
|
const stepDuration = useRef(1);
|
|
16
17
|
const stepEase = useRef('linear');
|
|
17
18
|
const animProgress = useRef(0);
|
|
19
|
+
const hasHoverFunctionalities = hasHoverAnimation(createdObject.animations);
|
|
20
|
+
const hasMouseInteraction = createdObject.interactions && createdObject.interactions.actions.length > 0;
|
|
18
21
|
const baseRef = useRef({ position: [...position], scale: [...scale], rotation: [...rotation] });
|
|
19
22
|
const targetRef = useRef({
|
|
20
23
|
position: targetPosition ? [...targetPosition] : [...position],
|
|
@@ -43,85 +46,20 @@ visible = true, children, parentRef, handleObjectClick, onPointerEnter, onPointe
|
|
|
43
46
|
animProgress.current = 0;
|
|
44
47
|
}, [position, scale, rotation, targetPosition, targetScale, targetRotation]);
|
|
45
48
|
useEffect(() => { syncTransform(); }, [position, scale, rotation, targetPosition, targetScale, targetRotation]);
|
|
46
|
-
// useAnimationEvents({
|
|
47
|
-
// onStepStart: (event) => {
|
|
48
|
-
// console.log('Received animation event:', event);
|
|
49
|
-
// if (!event.step?.transitions) return;
|
|
50
|
-
// const d = event.step.duration || 1;
|
|
51
|
-
// for (const { state, properties, pathId } of event.step.transitions) {
|
|
52
|
-
// console.log(`Animation event for state: ${state}, object stateKey: ${stateKey}`);
|
|
53
|
-
// if (state !== stateKey) continue;
|
|
54
|
-
// if (properties.to.visible === false) {
|
|
55
|
-
// if (groupRef.current) groupRef.current.visible = false;
|
|
56
|
-
// } else {
|
|
57
|
-
// if (groupRef.current) groupRef.current.visible = true;
|
|
58
|
-
// stepDuration.current = d;
|
|
59
|
-
// stepEase.current = event.step.ease || 'linear';
|
|
60
|
-
// animationStartTime.current = performance.now();
|
|
61
|
-
// animProgress.current = 0;
|
|
62
|
-
// if (pathId) {
|
|
63
|
-
// startPathAnimation(pathId, d, { ease: stepEase.current });
|
|
64
|
-
// } else {
|
|
65
|
-
// const cur = targetRef.current;
|
|
66
|
-
// baseRef.current = {
|
|
67
|
-
// position: (properties.from?.position ? [...properties.from.position] : cur.position) as [number, number, number],
|
|
68
|
-
// rotation: (properties.from?.rotation ? [...properties.from.rotation] : cur.rotation) as [number, number, number],
|
|
69
|
-
// scale: (properties.from?.scale ? [...properties.from.scale] : cur.scale) as [number, number, number],
|
|
70
|
-
// };
|
|
71
|
-
// targetRef.current = {
|
|
72
|
-
// position: (properties.to?.position ? [...properties.to.position] : cur.position) as [number, number, number],
|
|
73
|
-
// rotation: (properties.to?.rotation ? [...properties.to.rotation] : cur.rotation) as [number, number, number],
|
|
74
|
-
// scale: (properties.to?.scale ? [...properties.to.scale] : cur.scale) as [number, number, number],
|
|
75
|
-
// };
|
|
76
|
-
// }
|
|
77
|
-
// }
|
|
78
|
-
// }
|
|
79
|
-
// },
|
|
80
|
-
// });
|
|
81
|
-
// const applyTransformProgress = useCallback(() => {
|
|
82
|
-
// const obj = groupRef.current;
|
|
83
|
-
// if (!obj || animationStartTime.current === null) return;
|
|
84
|
-
// const p = AnimationsManager.getProgressFromTime(
|
|
85
|
-
// animationStartTime.current,
|
|
86
|
-
// stepDuration.current,
|
|
87
|
-
// stepEase.current,
|
|
88
|
-
// );
|
|
89
|
-
// animProgress.current = p;
|
|
90
|
-
// const b = baseRef.current, t = targetRef.current;
|
|
91
|
-
// obj.position.set(
|
|
92
|
-
// b.position[0] + (t.position[0] - b.position[0]) * p,
|
|
93
|
-
// b.position[1] + (t.position[1] - b.position[1]) * p,
|
|
94
|
-
// b.position[2] + (t.position[2] - b.position[2]) * p,
|
|
95
|
-
// );
|
|
96
|
-
// obj.scale.set(
|
|
97
|
-
// b.scale[0] + (t.scale[0] - b.scale[0]) * p,
|
|
98
|
-
// b.scale[1] + (t.scale[1] - b.scale[1]) * p,
|
|
99
|
-
// b.scale[2] + (t.scale[2] - b.scale[2]) * p,
|
|
100
|
-
// );
|
|
101
|
-
// obj.rotation.set(
|
|
102
|
-
// b.rotation[0] + (t.rotation[0] - b.rotation[0]) * p,
|
|
103
|
-
// b.rotation[1] + (t.rotation[1] - b.rotation[1]) * p,
|
|
104
|
-
// b.rotation[2] + (t.rotation[2] - b.rotation[2]) * p,
|
|
105
|
-
// );
|
|
106
|
-
// }, []);
|
|
107
|
-
// useFrame((_state, delta) => {
|
|
108
|
-
// if (!visible || !groupRef.current) return;
|
|
109
|
-
// if (animProgress.current < 1) {
|
|
110
|
-
// if (isPathAnimating()) {
|
|
111
|
-
// const still = updatePathAnimation(delta, groupRef.current);
|
|
112
|
-
// if (!still) { animProgress.current = 1; animationStartTime.current = null; }
|
|
113
|
-
// } else if (animationStartTime.current !== null) {
|
|
114
|
-
// applyTransformProgress();
|
|
115
|
-
// }
|
|
116
|
-
// }
|
|
117
|
-
// if (anchor) applyAnchorSettings(anchor, groupRef.current, rotation);
|
|
118
|
-
// });
|
|
119
49
|
const onClick = (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
120
51
|
if (handleObjectClick && groupRef.current) {
|
|
121
52
|
handleObjectClick(createdObject, groupRef.current, e);
|
|
122
53
|
}
|
|
123
54
|
};
|
|
124
|
-
|
|
55
|
+
// console.log("AnimatedObject render", { name: createdObject.meshSettings.name, id: createdObject.id, hovered, hasHoverFunctionalities })
|
|
56
|
+
if (createdObject.type === 'particles' || createdObject.type === 'gallery' || (!hasHoverFunctionalities && !hasMouseInteraction)) {
|
|
57
|
+
return _jsx(_Fragment, { children: _jsxs("group", { ref: groupRef, position: position, scale: scale, rotation: rotation, visible: visible, onClick: onClick,
|
|
58
|
+
// onPointerEnter={onPointerEnter}
|
|
59
|
+
// onPointerLeave={onPointerLeave}
|
|
60
|
+
name: createdObject.meshSettings.name, userData: { id: createdObject.id }, children: [children, _jsx(EffectsGroup, { createdObject: createdObject })] }) });
|
|
61
|
+
}
|
|
62
|
+
return (_jsx(_Fragment, { children: _jsxs("group", { ref: groupRef, position: position, scale: scale, rotation: rotation, visible: visible, onClick: onClick, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, name: createdObject.meshSettings.name, userData: { id: createdObject.id }, children: [children, _jsx(EffectsGroup, { createdObject: createdObject })] }) }));
|
|
125
63
|
});
|
|
126
64
|
AnimatedObject.displayName = 'AnimatedObject';
|
|
127
65
|
export default AnimatedObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CameraState } from '@ntalmagor/3drize-core';
|
|
2
2
|
interface CameraControllerProps {
|
|
3
|
+
settings: CameraState;
|
|
3
4
|
enableAutoAnimation?: boolean;
|
|
4
5
|
animationDuration?: number;
|
|
5
6
|
animationEase?: string;
|
|
6
|
-
settings: CameraState;
|
|
7
7
|
}
|
|
8
8
|
export declare const CameraController: React.FC<CameraControllerProps>;
|
|
9
9
|
export default CameraController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../src/components/CameraController.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../src/components/CameraController.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAiD,MAAM,wBAAwB,CAAC;AAIzG,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,WAAW,CAAA;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsM5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useEffect, useRef } from 'react';
|
|
2
3
|
import { useFrame, useThree } from '@react-three/fiber';
|
|
3
4
|
import { useCameraAnimation } from '../hooks/useCameraAnimation.js';
|
|
4
5
|
import { cameraManager } from '../utils/CameraSingleton.js';
|
|
5
6
|
import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
|
|
6
7
|
import { usePathAnimation } from '../hooks/usePathAnimation.js';
|
|
7
|
-
|
|
8
|
+
import { OrbitControls } from "@react-three/drei";
|
|
9
|
+
export const CameraController = ({ enableAutoAnimation = true, animationDuration = 1, animationEase = "power2.out", settings, }) => {
|
|
8
10
|
const { camera, set } = useThree();
|
|
9
11
|
const cameraRef = useRef(camera);
|
|
10
12
|
const transformAnimationProgress = useRef(0);
|
|
11
|
-
const
|
|
13
|
+
const controlsRef = useRef(null);
|
|
14
|
+
const { position, orientation, fov, near, far, controls } = settings;
|
|
15
|
+
const initialControls = useRef(controls);
|
|
12
16
|
const { startPathAnimation, updatePathAnimation, isAnimating: isPathAnimating, } = usePathAnimation();
|
|
13
17
|
// Use camera animation hook for animated transitions (via events)
|
|
14
18
|
const { animateCamera, animateHandlers, isAnimating } = useCameraAnimation({
|
|
@@ -43,6 +47,27 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
|
|
|
43
47
|
console.log("CameraController: Synced position/orientation", position, orientation);
|
|
44
48
|
}
|
|
45
49
|
}, [position, orientation]);
|
|
50
|
+
// Sync controls config changes imperatively via ref (after initial mount)
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const orbitControls = controlsRef.current;
|
|
53
|
+
if (!orbitControls)
|
|
54
|
+
return;
|
|
55
|
+
orbitControls.enabled = controls.enabled;
|
|
56
|
+
orbitControls.target.set(controls.target[0], controls.target[1], controls.target[2]);
|
|
57
|
+
orbitControls.enablePan = controls.enablePan;
|
|
58
|
+
orbitControls.enableRotate = controls.enableRotate;
|
|
59
|
+
orbitControls.autoRotate = controls.autoRotate;
|
|
60
|
+
orbitControls.autoRotateSpeed = controls.autoRotateSpeed;
|
|
61
|
+
orbitControls.zoomSpeed = controls.zoomSpeed;
|
|
62
|
+
orbitControls.panSpeed = controls.panSpeed;
|
|
63
|
+
orbitControls.rotateSpeed = controls.rotateSpeed;
|
|
64
|
+
orbitControls.minDistance = controls.minDistance;
|
|
65
|
+
orbitControls.maxDistance = controls.maxDistance;
|
|
66
|
+
orbitControls.minPolarAngle = controls.minPolarAngle ?? -Infinity;
|
|
67
|
+
orbitControls.maxPolarAngle = controls.maxPolarAngle ?? Infinity;
|
|
68
|
+
orbitControls.minAzimuthAngle = controls.minAzimuthAngle ?? -Infinity;
|
|
69
|
+
orbitControls.maxAzimuthAngle = controls.maxAzimuthAngle ?? Infinity;
|
|
70
|
+
}, [controls]);
|
|
46
71
|
// Sync camera projection settings from state
|
|
47
72
|
useEffect(() => {
|
|
48
73
|
const cam = cameraRef.current;
|
|
@@ -74,16 +99,9 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
|
|
|
74
99
|
event.step.transitions.forEach((transition) => {
|
|
75
100
|
const { state, properties, pathId } = transition;
|
|
76
101
|
if (state === 'camera') {
|
|
102
|
+
console.log('Camera transition detected. Starting animation to new camera state:', properties);
|
|
77
103
|
isInAnimatedTransition.current = true;
|
|
78
|
-
|
|
79
|
-
fov: properties.to.fov,
|
|
80
|
-
near: properties.to.near,
|
|
81
|
-
far: properties.to.far,
|
|
82
|
-
};
|
|
83
|
-
if (!pathId) {
|
|
84
|
-
targetSettings.position = properties.to.position;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
104
|
+
if (pathId) {
|
|
87
105
|
const offset = camera
|
|
88
106
|
? [camera.position.x, camera.position.y, camera.position.z]
|
|
89
107
|
: [0, 0, 0];
|
|
@@ -94,15 +112,31 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
|
|
|
94
112
|
});
|
|
95
113
|
transformAnimationProgress.current = 0;
|
|
96
114
|
}
|
|
97
|
-
console.log("Animating camera to:", targetSettings, "over duration:", stepDuration);
|
|
115
|
+
// console.log("Animating camera to:", targetSettings, "over duration:", stepDuration);
|
|
116
|
+
const startSettings = properties.from ?
|
|
117
|
+
{
|
|
118
|
+
position: properties.from.position,
|
|
119
|
+
// orientation: properties.from.orientation,
|
|
120
|
+
} : {
|
|
121
|
+
position: camera.position,
|
|
122
|
+
// orientation: camera.rotation,
|
|
123
|
+
};
|
|
124
|
+
const targetSettings = properties.to;
|
|
125
|
+
console.log("Starting camera animation from:", startSettings);
|
|
126
|
+
// startSettings.position && camera.position.set(startSettings.position[0], startSettings.position[1], startSettings.position[2]);
|
|
127
|
+
// camera.rotation.set(startSettings.orientation[0], startSettings.orientation[1], startSettings.orientation[2]);
|
|
98
128
|
animateCamera(targetSettings, stepDuration, event.step?.ease, properties.to.target)
|
|
99
129
|
.then(() => {
|
|
100
130
|
isInAnimatedTransition.current = false;
|
|
131
|
+
if (properties.to.target) {
|
|
132
|
+
controlsRef.current?.target.set(properties.to.target[0], properties.to.target[1], properties.to.target[2]);
|
|
133
|
+
}
|
|
134
|
+
;
|
|
101
135
|
});
|
|
102
136
|
}
|
|
103
137
|
});
|
|
104
138
|
}
|
|
105
|
-
}
|
|
139
|
+
}
|
|
106
140
|
});
|
|
107
141
|
// Frame loop for path animations and mouse handlers
|
|
108
142
|
useFrame((state, delta) => {
|
|
@@ -116,6 +150,9 @@ export const CameraController = ({ enableAutoAnimation = true, animationDuration
|
|
|
116
150
|
animateHandlers(state.pointer);
|
|
117
151
|
}
|
|
118
152
|
});
|
|
119
|
-
|
|
153
|
+
const ic = initialControls.current;
|
|
154
|
+
return _jsx(OrbitControls, { ref: controlsRef, makeDefault: true, enabled: ic.enabled,
|
|
155
|
+
// target={new Vector3(...ic.target)}
|
|
156
|
+
enablePan: ic.enablePan, enableRotate: ic.enableRotate, autoRotate: ic.autoRotate, autoRotateSpeed: ic.autoRotateSpeed, zoomSpeed: ic.zoomSpeed, panSpeed: ic.panSpeed, rotateSpeed: ic.rotateSpeed, minDistance: ic.minDistance, maxDistance: ic.maxDistance, minPolarAngle: ic.minPolarAngle ?? -Infinity, maxPolarAngle: ic.maxPolarAngle ?? Infinity, minAzimuthAngle: ic.minAzimuthAngle ?? -Infinity, maxAzimuthAngle: ic.maxAzimuthAngle ?? Infinity });
|
|
120
157
|
};
|
|
121
158
|
export default CameraController;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type { TimeSettings } from '@ntalmagor/3drize-core';
|
|
2
|
+
import type { CloudsSettings, TimeSettings } from '@ntalmagor/3drize-core';
|
|
4
3
|
export interface CloudsProps {
|
|
5
|
-
|
|
6
|
-
scale?: number;
|
|
7
|
-
height?: number;
|
|
8
|
-
speed?: number;
|
|
9
|
-
materialSettings?: MaterialSettings;
|
|
4
|
+
settings: CloudsSettings;
|
|
10
5
|
timeSettings: TimeSettings;
|
|
11
6
|
}
|
|
12
7
|
declare const Clouds: React.FC<CloudsProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAO7D,OAAO,KAAK,EAAE,cAAc,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAoB7F,MAAM,WAAW,WAAW;IAE1B,QAAQ,EAAE,cAAc,CAAA;IACxB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAqKjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -4,6 +4,10 @@ import * as THREE from 'three';
|
|
|
4
4
|
import { useThree, useFrame } from '@react-three/fiber';
|
|
5
5
|
import { useMaterialApplication } from '../hooks/useMaterialApplication.js';
|
|
6
6
|
import { useSkySystem } from '../hooks/useSkySystem.js';
|
|
7
|
+
import { useAnimationEvents } from '../hooks/useAnimationEvents.js';
|
|
8
|
+
import { useNumericAnimation } from '../hooks/useNumericAnimation.js';
|
|
9
|
+
import { applySingleProperty } from '@ntalmagor/3drize-core';
|
|
10
|
+
import { useMouseHandlers } from '../hooks/useMouseHandlers.js';
|
|
7
11
|
const CLOUD_COLORS = {
|
|
8
12
|
night: new THREE.Color(0.1, 0.1, 0.2),
|
|
9
13
|
sunrise: new THREE.Color(0.8, 0.4, 0.4),
|
|
@@ -18,12 +22,17 @@ const DEFAULT_MATERIAL = {
|
|
|
18
22
|
u_cameraPos: [0, 0, 0],
|
|
19
23
|
u_cloudColor: [1.0, 1.0, 1.0],
|
|
20
24
|
};
|
|
21
|
-
const Clouds = ({
|
|
25
|
+
const Clouds = ({ settings, timeSettings, }) => {
|
|
26
|
+
const { visible = true, position = [0, 400, 0], scale = 15000, speed = 1, materialSettings = DEFAULT_MATERIAL, handlers } = settings;
|
|
27
|
+
const height = position?.[1] ?? 400;
|
|
22
28
|
const [meshNode, setMeshNode] = useState(null);
|
|
23
29
|
const cloudAnimTime = useRef(0);
|
|
24
30
|
const { camera } = useThree();
|
|
31
|
+
const { interpolateProperty } = useMouseHandlers();
|
|
25
32
|
const cloudColorRef = useRef(new THREE.Color(1, 1, 1));
|
|
26
33
|
const targetCloudColorRef = useRef(new THREE.Color(1, 1, 1));
|
|
34
|
+
const numericOverrideRef = useRef(null);
|
|
35
|
+
const { animateNumeric } = useNumericAnimation();
|
|
27
36
|
const meshRefCallback = useCallback((node) => {
|
|
28
37
|
setMeshNode(node);
|
|
29
38
|
}, []);
|
|
@@ -59,14 +68,65 @@ const Clouds = ({ visible = true, scale = 1, height = 400, speed = 1, materialSe
|
|
|
59
68
|
onTimeUpdate: handleTimeUpdate,
|
|
60
69
|
enabled: visible,
|
|
61
70
|
});
|
|
62
|
-
|
|
71
|
+
useAnimationEvents({
|
|
72
|
+
onStepStart: (event) => {
|
|
73
|
+
if (!event.step?.transitions)
|
|
74
|
+
return;
|
|
75
|
+
for (const transition of event.step.transitions) {
|
|
76
|
+
if (transition.state !== 'clouds' || !meshNode)
|
|
77
|
+
continue;
|
|
78
|
+
const toProps = transition.properties.to || {};
|
|
79
|
+
const fromProps = transition.properties.from || {};
|
|
80
|
+
// visible — immediate boolean switch on the Three.js mesh
|
|
81
|
+
if (toProps.visible !== undefined) {
|
|
82
|
+
meshNode.visible = toProps.visible;
|
|
83
|
+
}
|
|
84
|
+
// numeric: speed, scale
|
|
85
|
+
const CLOUDS_NUMERIC_KEYS = ['speed', 'scale'];
|
|
86
|
+
const from = {};
|
|
87
|
+
const to = {};
|
|
88
|
+
for (const key of CLOUDS_NUMERIC_KEYS) {
|
|
89
|
+
const toVal = toProps[key];
|
|
90
|
+
if (toVal === undefined)
|
|
91
|
+
continue;
|
|
92
|
+
to[key] = toVal;
|
|
93
|
+
from[key] = fromProps[key] ?? settings[key] ?? toVal;
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(to).length > 0) {
|
|
96
|
+
animateNumeric(from, to, (updated) => {
|
|
97
|
+
numericOverrideRef.current = { ...numericOverrideRef.current, ...updated };
|
|
98
|
+
}, () => {
|
|
99
|
+
numericOverrideRef.current = null;
|
|
100
|
+
}, event.step?.duration);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const handleMouseMove = (mouse) => {
|
|
106
|
+
// Mouse-move property handlers
|
|
107
|
+
if (handlers?.onMouseMove?.enabled && handlers.onMouseMove.properties.length && meshNode) {
|
|
108
|
+
handlers.onMouseMove.properties.forEach((props) => {
|
|
109
|
+
const { property, propertySettings } = props;
|
|
110
|
+
const { min: minValue, max: maxValue, axis, sensitivity = 1, inverted = false } = propertySettings;
|
|
111
|
+
const baseValue = settings.materialSettings[property];
|
|
112
|
+
if (!baseValue)
|
|
113
|
+
return;
|
|
114
|
+
const interpolatedValue = interpolateProperty(baseValue, minValue, maxValue, mouse, axis, sensitivity, inverted);
|
|
115
|
+
if (meshNode) {
|
|
116
|
+
applySingleProperty(meshNode.material, property, interpolatedValue);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
useFrame((state) => {
|
|
63
122
|
if (!visible || !meshNode?.material)
|
|
64
123
|
return;
|
|
65
124
|
const material = meshNode.material;
|
|
66
125
|
const uniforms = material?.uniforms;
|
|
67
126
|
if (!uniforms)
|
|
68
127
|
return;
|
|
69
|
-
cloudAnimTime.current += 0.02 * speed;
|
|
128
|
+
cloudAnimTime.current += 0.02 * (numericOverrideRef.current?.speed ?? speed);
|
|
129
|
+
const mouse = state.pointer;
|
|
70
130
|
if (uniforms.u_time)
|
|
71
131
|
uniforms.u_time.value = cloudAnimTime.current;
|
|
72
132
|
if (uniforms.u_cameraPos) {
|
|
@@ -89,6 +149,10 @@ const Clouds = ({ visible = true, scale = 1, height = 400, speed = 1, materialSe
|
|
|
89
149
|
? uniforms.u_sunPosition.value.copy(sunDirection)
|
|
90
150
|
: (uniforms.u_sunPosition.value = sunDirection.clone());
|
|
91
151
|
}
|
|
152
|
+
handleMouseMove(mouse);
|
|
153
|
+
if (numericOverrideRef.current?.scale !== undefined) {
|
|
154
|
+
meshNode.scale.setScalar(numericOverrideRef.current.scale);
|
|
155
|
+
}
|
|
92
156
|
});
|
|
93
157
|
if (!visible)
|
|
94
158
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAG,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAOrG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD,UAAU,kBAAkB;IAC1B,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAElH;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"CreatedObject.d.ts","sourceRoot":"","sources":["../../src/components/CreatedObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAG,qBAAqB,EAAkC,MAAM,wBAAwB,CAAC;AAOrG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD,UAAU,kBAAkB;IAC1B,aAAa,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAElH;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwJ9C,CAAC;AAIH,eAAe,aAAa,CAAC"}
|
|
@@ -60,14 +60,17 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
|
|
|
60
60
|
// Check if this should use the new MaterialLibrary system for Drei materials
|
|
61
61
|
// console.log(object)
|
|
62
62
|
const handleObjectEnter = (e) => {
|
|
63
|
-
|
|
63
|
+
console.log(e);
|
|
64
64
|
// Only handle if this is the actual mesh group, not a child
|
|
65
65
|
if (e.eventObject !== meshRef.current)
|
|
66
66
|
return;
|
|
67
67
|
if (createdObject.type === 'particles' || createdObject.type === 'gallery')
|
|
68
68
|
return;
|
|
69
|
-
e.stopPropagation();
|
|
69
|
+
// e.stopPropagation();
|
|
70
70
|
handlePointerEnter(e);
|
|
71
|
+
if (createdObject.interactions) {
|
|
72
|
+
document.body.style.cursor = 'pointer';
|
|
73
|
+
}
|
|
71
74
|
};
|
|
72
75
|
const handleObjectLeave = (e) => {
|
|
73
76
|
// Only handle if this is the actual mesh group, not a child
|
|
@@ -76,21 +79,9 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
|
|
|
76
79
|
if (createdObject.type === 'particles' || createdObject.type === 'gallery')
|
|
77
80
|
return;
|
|
78
81
|
handlePointerLeave();
|
|
82
|
+
document.body.style.cursor = 'auto';
|
|
79
83
|
e.stopPropagation();
|
|
80
84
|
};
|
|
81
|
-
const onClick = (e) => {
|
|
82
|
-
console.log('[1] CreatedObject.handleObjectClick:', createdObject.id, createdObject.meshSettings?.name);
|
|
83
|
-
// if (createdObject.type === 'gallery') {
|
|
84
|
-
// e.stopPropagation();
|
|
85
|
-
// return
|
|
86
|
-
// }
|
|
87
|
-
// contextHandleObjectClick(
|
|
88
|
-
// createdObject,
|
|
89
|
-
// meshRef.current,
|
|
90
|
-
// [0, 0, 0],
|
|
91
|
-
// e
|
|
92
|
-
// );
|
|
93
|
-
};
|
|
94
85
|
const anchorEnabled = createdObject.meshSettings.anchor && createdObject.meshSettings.anchor.enabled;
|
|
95
86
|
// console.log("createdObject.meshSettings", createdObject.meshSettings)
|
|
96
87
|
// console.log("Rendered CreatedObject:", createdObject.rigidBodySettings);
|
|
@@ -105,7 +96,7 @@ const CreatedObject = memo(({ createdObject, children, shouldApply3driseMaterial
|
|
|
105
96
|
position: anchorEnabled ? [anchoredPosition.x, anchoredPosition.y, anchoredPosition.z] : animatedTransform.position
|
|
106
97
|
}, createdObject: createdObject,
|
|
107
98
|
// animateMaterial={!useDreiMaterials}
|
|
108
|
-
parentRef: meshRef, visible: createdObject.meshSettings.visible, handleObjectClick: handleObjectClick, onPointerEnter: handleObjectEnter, onPointerLeave: e => handleObjectLeave(e), children: createdObject.rigidBodySettings?.enabled ? (_jsx(RigidBody, { type: createdObject.rigidBodySettings?.type || 'dynamic', mass: createdObject.rigidBodySettings?.mass || 1, colliders: createdObject.userData?.type === 'plane'
|
|
99
|
+
parentRef: meshRef, visible: createdObject.meshSettings.visible, handleObjectClick: handleObjectClick, onPointerEnter: handleObjectEnter, onPointerLeave: e => handleObjectLeave(e), hovered: hovered, children: createdObject.rigidBodySettings?.enabled ? (_jsx(RigidBody, { type: createdObject.rigidBodySettings?.type || 'dynamic', mass: createdObject.rigidBodySettings?.mass || 1, colliders: createdObject.userData?.type === 'plane'
|
|
109
100
|
? 'cuboid' // Force box collider for planes
|
|
110
101
|
: undefined // Auto-detect for others
|
|
111
102
|
, friction: createdObject.rigidBodySettings?.friction, restitution: createdObject.rigidBodySettings?.restitution, gravityScale: createdObject.rigidBodySettings?.gravityScale ?? 1, linearDamping: createdObject.rigidBodySettings?.linearDamping ?? 0.01, angularDamping: createdObject.rigidBodySettings?.angularDamping ?? 0.01, children: children })) : (children) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAoB,KAAK,qBAAqB,EAI5B,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,UAAU,oBAAoB;IAC5B,aAAa,EAAE,qBAAqB,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAClH;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CustomPrimitive.d.ts","sourceRoot":"","sources":["../../src/components/CustomPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAoB,KAAK,qBAAqB,EAI5B,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,UAAU,oBAAoB;IAC5B,aAAa,EAAE,qBAAqB,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAClH;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsHlD,CAAC;AAIH,eAAe,eAAe,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useRef, useEffect, memo, useState } from "react";
|
|
3
|
-
import { ObjectManager
|
|
3
|
+
import { ObjectManager } from "@ntalmagor/3drize-core";
|
|
4
4
|
// import ObjectManager from "~/utils/ObjectManager";
|
|
5
5
|
import { useMaterialApplication } from "../hooks/useMaterialApplication.js";
|
|
6
|
-
import { useFrame } from "@react-three/fiber";
|
|
7
6
|
import MaterialLibrary from "./MaterialLibrary.js";
|
|
8
7
|
// import type { AnimatedTransform } from "~/types/mesh";
|
|
9
8
|
import CreatedObject from "./CreatedObject.js";
|
|
@@ -35,6 +34,7 @@ const CustomPrimitive = memo(({ createdObject, onObjectReady, handleObjectClick,
|
|
|
35
34
|
const willApplyMaterial = apply3driseMaterials && !!createdObject.materialSettings.materialVariant;
|
|
36
35
|
const [materialReady, setMaterialReady] = useState(!willApplyMaterial);
|
|
37
36
|
// Get the actual Three.js object from ObjectManager
|
|
37
|
+
// console.log("CustomPrimitive - ID:", createdObject.id, createdObject.meshSettings.name);
|
|
38
38
|
const obj = ObjectManager.getObject(createdObject.id);
|
|
39
39
|
// console.log("CustomPrimitive - Retrieved object from ObjectManager:", obj);
|
|
40
40
|
// Apply material directly to obj.object (always non-null when obj exists, available before the
|
|
@@ -51,20 +51,27 @@ const CustomPrimitive = memo(({ createdObject, onObjectReady, handleObjectClick,
|
|
|
51
51
|
const transformEffects = createdObject.animations?.transform?.effects || []; // Array of effects from transform domain
|
|
52
52
|
const enabledTransformEffects = transformEffects.filter(e => e.enabled);
|
|
53
53
|
// console.log(isSelected)
|
|
54
|
-
useFrame((state, dt) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
// useFrame((state, dt) => {
|
|
55
|
+
// if (!meshRef.current || !applyToChildren) return;
|
|
56
|
+
// const time = state.clock.elapsedTime;
|
|
57
|
+
// // Initialize effect state if needed
|
|
58
|
+
// if (!effectStateRef.current && meshRef.current) {
|
|
59
|
+
// effectStateRef.current = createDefaultEffectState(meshRef.current);
|
|
60
|
+
// }
|
|
61
|
+
// // Apply transform effects from new continuous structure (multiple effects)
|
|
62
|
+
// if (enabledTransformEffects.length > 0 && effectStateRef.current) {
|
|
63
|
+
// applyTransformEffects(
|
|
64
|
+
// meshRef.current,
|
|
65
|
+
// enabledTransformEffects, // Pass array of enabled effects
|
|
66
|
+
// time,
|
|
67
|
+
// dt,
|
|
68
|
+
// effectStateRef.current,
|
|
69
|
+
// hovered,
|
|
70
|
+
// clicked,
|
|
71
|
+
// sensitivity
|
|
72
|
+
// );
|
|
73
|
+
// }
|
|
74
|
+
// });
|
|
68
75
|
const geometry = obj.object.geometry;
|
|
69
76
|
return (
|
|
70
77
|
// <Select enabled={isSelected}>
|
|
@@ -79,5 +79,5 @@ export default function Letter({ letterData, config, materialSettings, hoverSett
|
|
|
79
79
|
const boxWidth = fontSize * 0.8;
|
|
80
80
|
const boxHeight = fontSize * 1.2;
|
|
81
81
|
const boxDepth = actualRenderMode === 'text3d' ? text3DConfig.height + text3DConfig.bevelThickness * 2 : text3DConfig.height + 1;
|
|
82
|
-
return (
|
|
82
|
+
return (_jsx("group", { position: letterData.position, rotation: [0, 0, 0], ref: groupRef, name: `letter-${letterData.char}-${letterData.index}`, userData: { char: letterData.char, index: letterData.index, position: letterData.position }, children: _jsx("group", { ref: letterRef, raycast: () => null, children: actualRenderMode === 'text3d' ? (_jsx(Center, { disableX: text2DConfig.anchorX === 'left', disableY: text2DConfig.anchorY === 'top', disableZ: false, children: _jsxs(Text3D, { font: text3dFontUrl || 'https://threejs.org/examples/fonts/helvetiker_regular.typeface.json', size: text3DConfig.size, height: text3DConfig.height, curveSegments: text3DConfig.curveSegments, bevelEnabled: text3DConfig.bevelEnabled, bevelThickness: text3DConfig.bevelThickness, bevelSize: text3DConfig.bevelSize, bevelOffset: text3DConfig.bevelOffset, bevelSegments: text3DConfig.bevelSegments, children: [letterData.char, useDreiMaterials && actualRenderMode === 'text3d' ? (_jsx(MaterialLibrary, { materialSettings: materialSettings })) : (_jsx("meshStandardMaterial", { color: color, transparent: opacity < 1, opacity: opacity }))] }) })) : (_jsx(Text, { fontSize: text2DConfig.fontSize, color: color, maxWidth: text2DConfig.maxWidth, lineHeight: text2DConfig.lineHeight, letterSpacing: text2DConfig.letterSpacing, textAlign: text2DConfig.textAlign, anchorX: text2DConfig.anchorX, anchorY: text2DConfig.anchorY, font: bitmapFontUrl || undefined, fillOpacity: opacity, children: letterData.char })) }) }));
|
|
83
83
|
}
|
|
@@ -5,6 +5,6 @@ export interface LoadingIndicatorProps {
|
|
|
5
5
|
animate?: boolean;
|
|
6
6
|
size?: number;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const LoadingIndicator: React.FC<LoadingIndicatorProps>;
|
|
9
9
|
export default LoadingIndicator;
|
|
10
10
|
//# sourceMappingURL=LoadingIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../src/components/LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA4ID,
|
|
1
|
+
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../src/components/LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA4ID,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAuBrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -136,7 +136,7 @@ function injectStyles() {
|
|
|
136
136
|
style.textContent = CSS;
|
|
137
137
|
document.head.appendChild(style);
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
const LoadingIndicator = ({ text, fullScreen = false, animate = true, size = 80, }) => {
|
|
140
140
|
useEffect(() => { injectStyles(); }, []);
|
|
141
141
|
return (_jsxs("div", { className: `loading-indicator${animate ? ' animate' : ''}${fullScreen ? ' loading-indicator-fullscreen' : ''}`, children: [_jsxs("div", { className: "loading-spinner", style: { width: `${size}px`, height: `${size}px` }, children: [_jsx("div", { className: "spinner-ring" }), _jsx("div", { className: "spinner-ring" }), _jsx("div", { className: "spinner-ring" })] }), text && _jsx("div", { className: "loading-text", children: text })] }));
|
|
142
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Ocean.d.ts","sourceRoot":"","sources":["../../src/components/Ocean.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAUhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8J/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
|