@3driseai/3drise-viewer 0.1.4 → 0.1.6
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/README.md +225 -0
- package/dist/components/AdvancedGrid.d.ts +16 -0
- package/dist/components/AdvancedGrid.d.ts.map +1 -0
- package/dist/components/AdvancedGrid.js +63 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +6 -4
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +0 -6
- package/dist/components/CircuitGrid.d.ts +22 -0
- package/dist/components/CircuitGrid.d.ts.map +1 -0
- package/dist/components/CircuitGrid.js +69 -0
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +0 -5
- package/dist/components/ContourGrid.d.ts +25 -0
- package/dist/components/ContourGrid.d.ts.map +1 -0
- package/dist/components/ContourGrid.js +74 -0
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +3 -6
- package/dist/components/CustomPrimitive.d.ts.map +1 -1
- package/dist/components/CustomPrimitive.js +0 -5
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +0 -2
- package/dist/components/EffectsGroup.d.ts +6 -0
- package/dist/components/EffectsGroup.d.ts.map +1 -1
- package/dist/components/EffectsGroup.js +14 -4
- package/dist/components/FractalGrid.d.ts +23 -0
- package/dist/components/FractalGrid.d.ts.map +1 -0
- package/dist/components/FractalGrid.js +72 -0
- package/dist/components/Frame.d.ts.map +1 -1
- package/dist/components/Frame.js +2 -3
- package/dist/components/GalleryLayout.d.ts.map +1 -1
- package/dist/components/GalleryLayout.js +0 -3
- package/dist/components/GeometryShape.d.ts.map +1 -1
- package/dist/components/GeometryShape.js +0 -4
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +0 -1
- package/dist/components/GridsGenerator.d.ts +4 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +28 -4
- package/dist/components/HdrPlaylistRenderer.d.ts.map +1 -1
- package/dist/components/HdrPlaylistRenderer.js +0 -1
- package/dist/components/HexGrid.d.ts +25 -0
- package/dist/components/HexGrid.d.ts.map +1 -0
- package/dist/components/HexGrid.js +72 -0
- package/dist/components/ImageGeometry.js +1 -1
- package/dist/components/Letter.d.ts.map +1 -1
- package/dist/components/Letter.js +1 -6
- package/dist/components/MoireGrid.d.ts +23 -0
- package/dist/components/MoireGrid.d.ts.map +1 -0
- package/dist/components/MoireGrid.js +76 -0
- package/dist/components/Moon.d.ts.map +1 -1
- package/dist/components/Moon.js +0 -1
- package/dist/components/ObjectNode.d.ts +1 -2
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +17 -20
- package/dist/components/ObjectNodeApi.d.ts +1 -2
- package/dist/components/ObjectNodeApi.d.ts.map +1 -1
- package/dist/components/ObjectNodeApi.js +7 -3
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +1 -4
- package/dist/components/ObjectsRendererApi.d.ts.map +1 -1
- package/dist/components/ObjectsRendererApi.js +4 -2
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +1 -4
- package/dist/components/ParticlesR3f.d.ts +0 -1
- package/dist/components/ParticlesR3f.d.ts.map +1 -1
- package/dist/components/PathRenderer.d.ts.map +1 -1
- package/dist/components/PathRenderer.js +0 -1
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +0 -28
- package/dist/components/QuasiGrid.d.ts +22 -0
- package/dist/components/QuasiGrid.d.ts.map +1 -0
- package/dist/components/QuasiGrid.js +68 -0
- package/dist/components/RadarGrid.d.ts +24 -0
- package/dist/components/RadarGrid.d.ts.map +1 -0
- package/dist/components/RadarGrid.js +71 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +0 -1
- package/dist/components/ShootingStar.js +2 -2
- package/dist/components/ShootingStars.d.ts.map +1 -1
- package/dist/components/ShootingStars.js +0 -1
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +0 -3
- package/dist/components/Skybox.d.ts +5 -0
- package/dist/components/Skybox.d.ts.map +1 -1
- package/dist/components/Skybox.js +0 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +0 -1
- package/dist/components/VoronoiGrid.d.ts +21 -0
- package/dist/components/VoronoiGrid.d.ts.map +1 -0
- package/dist/components/VoronoiGrid.js +67 -0
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +0 -1
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +0 -1
- package/dist/components/index.d.ts +19 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +9 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/hooks/index.d.ts +4 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/use3driseShader.d.ts.map +1 -1
- package/dist/hooks/use3driseShader.js +0 -9
- package/dist/hooks/useAnimationEvents.d.ts.map +1 -1
- package/dist/hooks/useAnimationEvents.js +0 -19
- package/dist/hooks/useCameraAnimation.d.ts.map +1 -1
- package/dist/hooks/useCameraAnimation.js +0 -5
- package/dist/hooks/useContinuousEffects.d.ts +2 -3
- package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
- package/dist/hooks/useContinuousEffects.js +16 -61
- package/dist/hooks/useFrameAnimations.d.ts.map +1 -1
- package/dist/hooks/useFrameAnimations.js +0 -4
- package/dist/hooks/useGridSurface.d.ts +46 -0
- package/dist/hooks/useGridSurface.d.ts.map +1 -0
- package/dist/hooks/useGridSurface.js +66 -0
- package/dist/hooks/useGsapAnimation.d.ts.map +1 -1
- package/dist/hooks/useGsapAnimation.js +0 -3
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +0 -25
- package/dist/hooks/useInteractionEffects.d.ts +2 -2
- package/dist/hooks/useInteractionEffects.d.ts.map +1 -1
- package/dist/hooks/useInteractionEffects.js +3 -1
- package/dist/hooks/useMaterialApplication.d.ts +2 -2
- package/dist/hooks/useMaterialApplication.d.ts.map +1 -1
- package/dist/hooks/useMaterialApplication.js +7 -18
- package/dist/hooks/useMaterialOptions.d.ts.map +1 -1
- package/dist/hooks/useMaterialOptions.js +0 -6
- package/dist/hooks/useMeshController.d.ts.map +1 -1
- package/dist/hooks/useMeshController.js +0 -16
- package/dist/hooks/useObjectAnimation.d.ts +13 -2
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
- package/dist/hooks/useObjectAnimation.js +26 -28
- package/dist/hooks/useObjectEdges.d.ts +2 -1
- package/dist/hooks/useObjectEdges.d.ts.map +1 -1
- package/dist/hooks/useObjectEdges.js +15 -3
- package/dist/hooks/useObjectEffects.d.ts.map +1 -1
- package/dist/hooks/useObjectEffects.js +0 -4
- package/dist/hooks/useRegisterScene.d.ts +17 -0
- package/dist/hooks/useRegisterScene.d.ts.map +1 -0
- package/dist/hooks/useRegisterScene.js +33 -0
- package/dist/hooks/useSequenceAnimation.d.ts +2 -2
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
- package/dist/hooks/useSequenceAnimation.js +5 -70
- package/dist/hooks/useShadowApplication.d.ts +2 -2
- package/dist/hooks/useShadowApplication.d.ts.map +1 -1
- package/dist/hooks/useShadowApplication.js +6 -2
- package/dist/hooks/useSkyAnimation.d.ts.map +1 -1
- package/dist/hooks/useSkyAnimation.js +0 -1
- package/dist/hooks/useSkySystem.d.ts.map +1 -1
- package/dist/hooks/useSkySystem.js +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/services/AnimationsManager.d.ts.map +1 -1
- package/dist/services/AnimationsManager.js +0 -1
- package/dist/shaders/CircuitGridMaterial.d.ts +76 -0
- package/dist/shaders/CircuitGridMaterial.d.ts.map +1 -0
- package/dist/shaders/CircuitGridMaterial.js +298 -0
- package/dist/shaders/ContourGridMaterial.d.ts +80 -0
- package/dist/shaders/ContourGridMaterial.d.ts.map +1 -0
- package/dist/shaders/ContourGridMaterial.js +259 -0
- package/dist/shaders/FractalGridMaterial.d.ts +76 -0
- package/dist/shaders/FractalGridMaterial.d.ts.map +1 -0
- package/dist/shaders/FractalGridMaterial.js +247 -0
- package/dist/shaders/HexGridMaterial.d.ts +73 -0
- package/dist/shaders/HexGridMaterial.d.ts.map +1 -0
- package/dist/shaders/HexGridMaterial.js +265 -0
- package/dist/shaders/MoireGridMaterial.d.ts +79 -0
- package/dist/shaders/MoireGridMaterial.d.ts.map +1 -0
- package/dist/shaders/MoireGridMaterial.js +271 -0
- package/dist/shaders/QuasiGridMaterial.d.ts +76 -0
- package/dist/shaders/QuasiGridMaterial.d.ts.map +1 -0
- package/dist/shaders/QuasiGridMaterial.js +238 -0
- package/dist/shaders/RadarGridMaterial.d.ts +77 -0
- package/dist/shaders/RadarGridMaterial.d.ts.map +1 -0
- package/dist/shaders/RadarGridMaterial.js +291 -0
- package/dist/shaders/VoronoiGridMaterial.d.ts +73 -0
- package/dist/shaders/VoronoiGridMaterial.d.ts.map +1 -0
- package/dist/shaders/VoronoiGridMaterial.js +266 -0
- package/dist/types/gridConfigs.d.ts +202 -0
- package/dist/types/gridConfigs.d.ts.map +1 -0
- package/dist/types/gridConfigs.js +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts +0 -1
- package/dist/utils/handleGenerativeEffectsAnimations.d.ts.map +1 -1
- package/dist/utils/handleGenerativeEffectsAnimations.js +0 -29
- package/dist/utils/resolveObject3D.d.ts +20 -0
- package/dist/utils/resolveObject3D.d.ts.map +1 -0
- package/dist/utils/resolveObject3D.js +9 -0
- package/dist/utils/shapes.d.ts.map +1 -1
- package/dist/utils/shapes.js +0 -1
- package/package.json +4 -4
|
@@ -33,14 +33,11 @@ export const useCameraAnimation = (options = {}, cameraState = {}) => {
|
|
|
33
33
|
// Animate camera to target values
|
|
34
34
|
const animateCamera = (target, duration = defaultDuration, ease = defaultEase, lookAtTarget) => {
|
|
35
35
|
const cam = cameraRef.current;
|
|
36
|
-
// console.log("animateCamera called with cam:", cam);
|
|
37
36
|
if (!cam)
|
|
38
37
|
return Promise.resolve();
|
|
39
38
|
// Kill any existing animation
|
|
40
39
|
killAnimation();
|
|
41
|
-
// console.log('animateCamera', duration, ease)
|
|
42
40
|
return new Promise((resolve) => {
|
|
43
|
-
// console.log("Animating camera with target:", target, "duration:", duration, "ease:", ease);
|
|
44
41
|
const timeline = gsap.timeline({
|
|
45
42
|
onStart: () => {
|
|
46
43
|
isAnimatingRef.current = true;
|
|
@@ -62,7 +59,6 @@ export const useCameraAnimation = (options = {}, cameraState = {}) => {
|
|
|
62
59
|
});
|
|
63
60
|
// Animate position
|
|
64
61
|
if (target.position) {
|
|
65
|
-
console.log("Animating camera to position:", target.position, duration, ease);
|
|
66
62
|
timeline.to(cam.position, {
|
|
67
63
|
x: target.position[0],
|
|
68
64
|
y: target.position[1],
|
|
@@ -122,7 +118,6 @@ export const useCameraAnimation = (options = {}, cameraState = {}) => {
|
|
|
122
118
|
}, 0);
|
|
123
119
|
}
|
|
124
120
|
// If lookAt target provided, animate the controls.target
|
|
125
|
-
// console.log("Animating camera with lookAtTarget:", lookAtTarget, orbitControls);
|
|
126
121
|
if (lookAtTarget && orbitControls) {
|
|
127
122
|
timeline.to(orbitControls.target, {
|
|
128
123
|
x: lookAtTarget[0],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CreatedObjectSettings, EffectState } from '@3driseai/3drise-core';
|
|
2
|
-
import {
|
|
2
|
+
import type { Object3DSource } from "../utils/resolveObject3D";
|
|
3
3
|
export interface UseContinuousEffectsOptions {
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
animateMaterial?: boolean;
|
|
@@ -9,7 +9,6 @@ export interface UseContinuousEffectsResult {
|
|
|
9
9
|
isPathAnimating: () => boolean;
|
|
10
10
|
effectStateRef: React.MutableRefObject<EffectState | null>;
|
|
11
11
|
}
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const useContinuousEffects: (objectSettings: CreatedObjectSettings | null, options: UseContinuousEffectsOptions, object: Object3D) => UseContinuousEffectsResult;
|
|
12
|
+
export declare const useContinuousEffects: (objectSettings: CreatedObjectSettings | null, options?: UseContinuousEffectsOptions, objectSource?: Object3DSource) => UseContinuousEffectsResult;
|
|
14
13
|
export default useContinuousEffects;
|
|
15
14
|
//# sourceMappingURL=useContinuousEffects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContinuousEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useContinuousEffects.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useContinuousEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useContinuousEffects.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,MAAM,WAAW,2BAA2B;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,0BAA0B;IACvC,eAAe,EAAE,MAAM,OAAO,CAAC;IAC/B,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC9D;AAGD,eAAO,MAAM,oBAAoB,GAEjC,gBAAgB,qBAAqB,GAAG,IAAI,EAAE,UAAS,2BAAgC,EAAE,eAAe,cAAc,KAAG,0BAgIxH,CAAC;AACF,eAAe,oBAAoB,CAAC"}
|
|
@@ -2,29 +2,14 @@ import { useRef, useEffect } from "react";
|
|
|
2
2
|
import { useFrame } from "@react-three/fiber";
|
|
3
3
|
import { animateUniforms, cacheChildrenWithMaterials, handleEdgesAnimations, handleMaterialAnimations, handleMaterialEffects, handleTransformAnimations, handleTransformEffect } from "@3driseai/3drise-core";
|
|
4
4
|
import usePathAnimation from "./usePathAnimation.js";
|
|
5
|
-
|
|
6
|
-
// DEBUG LOGGING
|
|
7
|
-
// â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
|
8
|
-
export const DEBUG_CONTINUOUS_EFFECTS = false;
|
|
9
|
-
const log = (message, ...args) => {
|
|
10
|
-
if (DEBUG_CONTINUOUS_EFFECTS) {
|
|
11
|
-
console.log(`[ObjectAnimations] ${message}`, ...args);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
5
|
+
import { resolveObject3D } from "../utils/resolveObject3D.js";
|
|
14
6
|
export const useContinuousEffects = (
|
|
15
7
|
// object: Object3D | null,
|
|
16
|
-
objectSettings, options = {},
|
|
8
|
+
objectSettings, options = {}, objectSource) => {
|
|
17
9
|
const { enabled = true, animateMaterial = true, hovered = false } = options;
|
|
18
|
-
// console.log("useObjectAnimation called with:", {
|
|
19
|
-
// object
|
|
20
|
-
// });
|
|
21
10
|
// const { object } = ref || {};
|
|
22
11
|
// Path animation hook for animations with pathId
|
|
23
12
|
const { startPathAnimation, updatePathAnimation, isAnimating: isPathAnimating, stopPathAnimation, } = usePathAnimation();
|
|
24
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
25
|
-
// REFS
|
|
26
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
27
|
-
// Track which path animation is currently active
|
|
28
13
|
const activePathIdRef = useRef(null);
|
|
29
14
|
const effectStateRef = useRef(null);
|
|
30
15
|
// Cache children with materials to avoid traverse() every frame
|
|
@@ -34,10 +19,6 @@ objectSettings, options = {}, object) => {
|
|
|
34
19
|
const startValuesRef = useRef({});
|
|
35
20
|
// Cache start values for edges animations
|
|
36
21
|
const edgesStartValuesRef = useRef({});
|
|
37
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
38
|
-
// DERIVED STATE (read from new continuous structure)
|
|
39
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
40
|
-
// Transform domain - now supports multiple effects (one per category)
|
|
41
22
|
const transformAnimations = objectSettings?.animations?.transform?.animations || [];
|
|
42
23
|
const transformEffects = objectSettings?.animations?.transform?.effects || [];
|
|
43
24
|
const enabledTransformEffects = transformEffects.filter(effect => effect.enabled);
|
|
@@ -63,26 +44,11 @@ objectSettings, options = {}, object) => {
|
|
|
63
44
|
const hasAnimations = hasTransformAnimations || hasMaterialAnimations;
|
|
64
45
|
// Continuous effects config
|
|
65
46
|
const applyToChildren = false;
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (!object || object === lastObjectRef.current)
|
|
71
|
-
return;
|
|
72
|
-
lastObjectRef.current = object;
|
|
73
|
-
childrenWithMaterialsRef.current = cacheChildrenWithMaterials(object);
|
|
74
|
-
log('cached children with materials', {
|
|
75
|
-
count: childrenWithMaterialsRef.current.length,
|
|
76
|
-
objectName: object.name
|
|
77
|
-
});
|
|
78
|
-
// Reset start values cache when object changes
|
|
79
|
-
startValuesRef.current = {};
|
|
80
|
-
edgesStartValuesRef.current = {};
|
|
81
|
-
}, [object]);
|
|
82
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
83
|
-
// PATH ANIMATION LIFECYCLE
|
|
84
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
47
|
+
// Done lazily inside the frame loop instead of in an effect: the ref only
|
|
48
|
+
// attaches after render, so an effect keyed on the object would miss the
|
|
49
|
+
// first (and often the only) chance to see it. See the swap check below.
|
|
85
50
|
useEffect(() => {
|
|
51
|
+
const object = resolveObject3D(objectSource);
|
|
86
52
|
if (!enabled || !object)
|
|
87
53
|
return;
|
|
88
54
|
// Path animations come from transform.animations
|
|
@@ -92,7 +58,6 @@ objectSettings, options = {}, object) => {
|
|
|
92
58
|
// Start path animation if not already active or if pathId changed
|
|
93
59
|
if (activePathIdRef.current !== pathAnimation.pathId) {
|
|
94
60
|
activePathIdRef.current = pathAnimation.pathId;
|
|
95
|
-
log('starting path animation', { pathId: pathAnimation.pathId, duration: pathAnimation.duration });
|
|
96
61
|
startPathAnimation(pathAnimation.pathId, pathAnimation.duration / 1000, {
|
|
97
62
|
ease: pathAnimation.ease,
|
|
98
63
|
loop: pathAnimation.loop,
|
|
@@ -105,20 +70,22 @@ objectSettings, options = {}, object) => {
|
|
|
105
70
|
}
|
|
106
71
|
else if (activePathIdRef.current) {
|
|
107
72
|
// Stop path animation if no longer active
|
|
108
|
-
// log('stopping path animation', { pathId: activePathIdRef.current });
|
|
109
73
|
stopPathAnimation();
|
|
110
74
|
activePathIdRef.current = null;
|
|
111
75
|
}
|
|
112
|
-
}, [enabled, objectSettings?.animations?.transform?.animations,
|
|
113
|
-
// console.log(objectSettings?.meshSettings.name, hovered)
|
|
76
|
+
}, [enabled, objectSettings?.animations?.transform?.animations, objectSource, startPathAnimation, stopPathAnimation]);
|
|
114
77
|
useFrame((state, delta) => {
|
|
115
|
-
|
|
116
|
-
// enabled,
|
|
117
|
-
// object,
|
|
118
|
-
// objectSettings,
|
|
119
|
-
// })
|
|
78
|
+
const object = resolveObject3D(objectSource);
|
|
120
79
|
if (!enabled || !object || !objectSettings)
|
|
121
80
|
return;
|
|
81
|
+
// Cache the object's materials the first frame we actually see it, and
|
|
82
|
+
// again if the caller swaps the object underneath us.
|
|
83
|
+
if (object !== lastObjectRef.current) {
|
|
84
|
+
lastObjectRef.current = object;
|
|
85
|
+
childrenWithMaterialsRef.current = cacheChildrenWithMaterials(object);
|
|
86
|
+
startValuesRef.current = {};
|
|
87
|
+
edgesStartValuesRef.current = {};
|
|
88
|
+
}
|
|
122
89
|
const time = state.clock.getElapsedTime();
|
|
123
90
|
const mouse = state.pointer;
|
|
124
91
|
const currentTime = Date.now();
|
|
@@ -127,9 +94,6 @@ objectSettings, options = {}, object) => {
|
|
|
127
94
|
if (pathIsActive) {
|
|
128
95
|
updatePathAnimation(delta, object);
|
|
129
96
|
}
|
|
130
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
131
|
-
// TRANSFORM DOMAIN
|
|
132
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
133
97
|
if (hasTransformAnimations) {
|
|
134
98
|
handleTransformAnimations({
|
|
135
99
|
object,
|
|
@@ -144,9 +108,6 @@ objectSettings, options = {}, object) => {
|
|
|
144
108
|
if (hasEdgesAnimations) {
|
|
145
109
|
handleEdgesAnimations({ object, startValuesCache: edgesStartValuesRef.current }, edgesAnimations, currentTime, hovered);
|
|
146
110
|
}
|
|
147
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
148
|
-
// MATERIAL DOMAIN
|
|
149
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
150
111
|
if (animateMaterial) {
|
|
151
112
|
// Handle material animations (any material property)
|
|
152
113
|
if (hasMaterialAnimations) {
|
|
@@ -160,13 +121,7 @@ objectSettings, options = {}, object) => {
|
|
|
160
121
|
if (enabledMaterialEffects.length > 0) {
|
|
161
122
|
handleMaterialEffects(object, enabledMaterialEffects, time, delta, effectStateRef, applyToChildren);
|
|
162
123
|
}
|
|
163
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
164
|
-
// EDGES DOMAIN
|
|
165
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
166
|
-
// Animate uniforms (u_time, u_mouse, u_camera_position)
|
|
167
|
-
// console.log(time)
|
|
168
124
|
}
|
|
169
|
-
// console.log(enabled)
|
|
170
125
|
animateUniforms(childrenWithMaterialsRef.current, time * speed, mouse, state.camera.position);
|
|
171
126
|
});
|
|
172
127
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFrameAnimations.d.ts","sourceRoot":"","sources":["../../src/hooks/useFrameAnimations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,UAAU,qBAAqB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AASD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,WAAW,KAAG;IACzD,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/E,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/E,wBAAwB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC5F,sBAAsB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzD,wBAAwB,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"useFrameAnimations.d.ts","sourceRoot":"","sources":["../../src/hooks/useFrameAnimations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,UAAU,qBAAqB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AASD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,WAAW,KAAG;IACzD,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/E,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/E,wBAAwB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC5F,sBAAsB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzD,wBAAwB,EAAE,MAAM,IAAI,CAAC;CAqM5C,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
|
@@ -48,7 +48,6 @@ export const useFrameAnimations = (cameraSettings) => {
|
|
|
48
48
|
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
49
49
|
const original = originalCameraStateRef.current;
|
|
50
50
|
if (!original) {
|
|
51
|
-
console.warn("No original camera state found");
|
|
52
51
|
return;
|
|
53
52
|
}
|
|
54
53
|
// Animate camera back to original position
|
|
@@ -84,7 +83,6 @@ export const useFrameAnimations = (cameraSettings) => {
|
|
|
84
83
|
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
85
84
|
const original = originalTransforms.get(object.uuid);
|
|
86
85
|
if (!original) {
|
|
87
|
-
console.warn("No original transform found for object", object.uuid);
|
|
88
86
|
return;
|
|
89
87
|
}
|
|
90
88
|
// Animate back to original transform
|
|
@@ -116,7 +114,6 @@ export const useFrameAnimations = (cameraSettings) => {
|
|
|
116
114
|
const cameraPos = cameraManager.getPosition();
|
|
117
115
|
const cameraDirection = cameraManager.getWorldDirection();
|
|
118
116
|
if (!cameraPos || !cameraDirection) {
|
|
119
|
-
console.warn("Camera not available for moveToFront animation");
|
|
120
117
|
return;
|
|
121
118
|
}
|
|
122
119
|
// Calculate target position in world space (in front of camera)
|
|
@@ -169,7 +166,6 @@ export const useFrameAnimations = (cameraSettings) => {
|
|
|
169
166
|
// Get current camera position
|
|
170
167
|
const cameraPos = cameraManager.getPosition();
|
|
171
168
|
if (!cameraPos) {
|
|
172
|
-
console.warn("Camera not available for zoomToFrame animation");
|
|
173
169
|
return;
|
|
174
170
|
}
|
|
175
171
|
// Get frame's world position
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* The uniforms every shader-plane grid in this package drives from the host
|
|
5
|
+
* rather than from the config: elapsed time, the pointer in NDC, the focus
|
|
6
|
+
* point that ripples and pings radiate from, and the assemble/dissolve amount.
|
|
7
|
+
*/
|
|
8
|
+
export interface GridSurfaceUniforms {
|
|
9
|
+
u_time: number;
|
|
10
|
+
u_mouse: THREE.Vector2;
|
|
11
|
+
u_focus: THREE.Vector2;
|
|
12
|
+
u_reveal: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GridSurfaceOptions {
|
|
15
|
+
/** project the pointer onto the plane and write it into u_focus */
|
|
16
|
+
followMouse?: boolean;
|
|
17
|
+
/** 0..1 target assemble amount; 1 is fully built, 0 is gone */
|
|
18
|
+
reveal?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Seconds to travel the full 0..1 range toward `reveal`. 0 applies the
|
|
21
|
+
* target immediately, which is the default — a grid does not animate itself
|
|
22
|
+
* in unless it is asked to.
|
|
23
|
+
*/
|
|
24
|
+
revealDuration?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Per-frame plumbing shared by every shader-plane grid in this package.
|
|
28
|
+
*
|
|
29
|
+
* Advances `u_time` with the raw clock (each shader applies its own
|
|
30
|
+
* `u_animSpeed`, matching MyGridMaterial), mirrors the pointer into `u_mouse`
|
|
31
|
+
* as NDC — the 3drise convention — projects the pointer onto the grid's own
|
|
32
|
+
* plane for `u_focus` when `followMouse` is on, and drives `u_reveal` toward
|
|
33
|
+
* its target.
|
|
34
|
+
*
|
|
35
|
+
* The pick plane is derived from the mesh's world matrix rather than hard-coded
|
|
36
|
+
* to XZ, so the projection stays correct whether the grid lies flat or stands
|
|
37
|
+
* upright, and whether or not the host applied a transform above it.
|
|
38
|
+
*
|
|
39
|
+
* Reveal is driven at a constant *rate* rather than by replaying a fixed
|
|
40
|
+
* timeline, so retargeting mid-flight — the dissolve that starts while the
|
|
41
|
+
* build is still running — continues smoothly from wherever it had got to
|
|
42
|
+
* instead of snapping back to the start.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useGridSurface(materialRef: RefObject<GridSurfaceUniforms | null>, meshRef: RefObject<THREE.Object3D | null>, options?: GridSurfaceOptions): void;
|
|
45
|
+
export default useGridSurface;
|
|
46
|
+
//# sourceMappingURL=useGridSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGridSurface.d.ts","sourceRoot":"","sources":["../../src/hooks/useGridSurface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,mEAAmE;IACnE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC1B,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,EAClD,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,EACzC,OAAO,GAAE,kBAAuB,GACjC,IAAI,CAgDN;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
/**
|
|
5
|
+
* Per-frame plumbing shared by every shader-plane grid in this package.
|
|
6
|
+
*
|
|
7
|
+
* Advances `u_time` with the raw clock (each shader applies its own
|
|
8
|
+
* `u_animSpeed`, matching MyGridMaterial), mirrors the pointer into `u_mouse`
|
|
9
|
+
* as NDC — the 3drise convention — projects the pointer onto the grid's own
|
|
10
|
+
* plane for `u_focus` when `followMouse` is on, and drives `u_reveal` toward
|
|
11
|
+
* its target.
|
|
12
|
+
*
|
|
13
|
+
* The pick plane is derived from the mesh's world matrix rather than hard-coded
|
|
14
|
+
* to XZ, so the projection stays correct whether the grid lies flat or stands
|
|
15
|
+
* upright, and whether or not the host applied a transform above it.
|
|
16
|
+
*
|
|
17
|
+
* Reveal is driven at a constant *rate* rather than by replaying a fixed
|
|
18
|
+
* timeline, so retargeting mid-flight — the dissolve that starts while the
|
|
19
|
+
* build is still running — continues smoothly from wherever it had got to
|
|
20
|
+
* instead of snapping back to the start.
|
|
21
|
+
*/
|
|
22
|
+
export function useGridSurface(materialRef, meshRef, options = {}) {
|
|
23
|
+
const { followMouse = false, reveal = 1, revealDuration = 0 } = options;
|
|
24
|
+
const scratch = useMemo(() => ({
|
|
25
|
+
ray: new THREE.Raycaster(),
|
|
26
|
+
plane: new THREE.Plane(),
|
|
27
|
+
hit: new THREE.Vector3(),
|
|
28
|
+
origin: new THREE.Vector3(),
|
|
29
|
+
normal: new THREE.Vector3(),
|
|
30
|
+
}), []);
|
|
31
|
+
// Starts at 0 when it has a duration to travel, so the first frame is the
|
|
32
|
+
// beginning of the build rather than a flash of the finished grid.
|
|
33
|
+
const revealNow = useRef(revealDuration > 0 ? 0 : reveal);
|
|
34
|
+
useFrame((state, delta) => {
|
|
35
|
+
const material = materialRef.current;
|
|
36
|
+
if (!material)
|
|
37
|
+
return;
|
|
38
|
+
material.u_time = state.clock.elapsedTime;
|
|
39
|
+
material.u_mouse.copy(state.pointer);
|
|
40
|
+
const target = THREE.MathUtils.clamp(reveal, 0, 1);
|
|
41
|
+
if (revealDuration > 0) {
|
|
42
|
+
const step = delta / revealDuration;
|
|
43
|
+
const remaining = target - revealNow.current;
|
|
44
|
+
revealNow.current += Math.sign(remaining) * Math.min(Math.abs(remaining), step);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
revealNow.current = target;
|
|
48
|
+
}
|
|
49
|
+
material.u_reveal = revealNow.current;
|
|
50
|
+
const mesh = meshRef.current;
|
|
51
|
+
if (!followMouse || !mesh)
|
|
52
|
+
return;
|
|
53
|
+
const { ray, plane, hit, origin, normal } = scratch;
|
|
54
|
+
mesh.updateWorldMatrix(true, false);
|
|
55
|
+
// A PlaneGeometry lives in local XY, so local +Z is its normal.
|
|
56
|
+
normal.set(0, 0, 1).transformDirection(mesh.matrixWorld).normalize();
|
|
57
|
+
origin.setFromMatrixPosition(mesh.matrixWorld);
|
|
58
|
+
plane.setFromNormalAndCoplanarPoint(normal, origin);
|
|
59
|
+
ray.setFromCamera(state.pointer, state.camera);
|
|
60
|
+
if (ray.ray.intersectPlane(plane, hit)) {
|
|
61
|
+
mesh.worldToLocal(hit);
|
|
62
|
+
material.u_focus.set(hit.x, hit.y);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export default useGridSurface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGsapAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useGsapAnimation.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C7B,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,eAAc,GAAG,EAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useGsapAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useGsapAnimation.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C7B,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,eAAc,GAAG,EAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqPxD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
|
|
@@ -75,7 +75,6 @@ export const useGsapAnimation = (dependencies = []) => {
|
|
|
75
75
|
* Animates multiple 3D objects with the given settings
|
|
76
76
|
*/
|
|
77
77
|
const animateObjects = (objects, settings = DEFAULT_SETTINGS) => {
|
|
78
|
-
console.log("Animating objects with settings:", settings, objects);
|
|
79
78
|
const finalSettings = { ...DEFAULT_SETTINGS, ...settings };
|
|
80
79
|
objects.forEach((object, index) => {
|
|
81
80
|
const targetPosition = new THREE.Vector3(...(finalSettings.position || [0, 0, 0]));
|
|
@@ -217,10 +216,8 @@ export const useGsapAnimation = (dependencies = []) => {
|
|
|
217
216
|
* Pulses objects (scale up and down)
|
|
218
217
|
*/
|
|
219
218
|
const animatePulse = useCallback((objects, settings = {}) => {
|
|
220
|
-
console.log("Animating pulse for objects", objects, "with settings", settings);
|
|
221
219
|
objects.forEach((object, index) => {
|
|
222
220
|
const delay = (settings.delay || 0) + (index * 0.1);
|
|
223
|
-
console.log("Animating pulse for object", object, "with delay", delay);
|
|
224
221
|
gsap.to(object.scale, {
|
|
225
222
|
x: 2.2,
|
|
226
223
|
y: 2.2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInteraction.d.ts","sourceRoot":"","sources":["../../src/hooks/useInteraction.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAA4B,MAAM,uBAAuB,CAAC;AAatG,wBAAgB,cAAc,CAAC,EAE/B,cAAc,EAAE,SAAS,GAAG,EAAE;IAClB,cAAc,EAAE,WAAW,CAAC;IAC5B,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAClC;;;;;
|
|
1
|
+
{"version":3,"file":"useInteraction.d.ts","sourceRoot":"","sources":["../../src/hooks/useInteraction.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAA4B,MAAM,uBAAuB,CAAC;AAatG,wBAAgB,cAAc,CAAC,EAE/B,cAAc,EAAE,SAAS,GAAG,EAAE;IAClB,cAAc,EAAE,WAAW,CAAC;IAC5B,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAClC;;;;;EA+NR;AACD,eAAe,cAAc,CAAC"}
|
|
@@ -42,7 +42,6 @@ cameraSettings, sequences, }) {
|
|
|
42
42
|
if (!targetIds || targetIds.length === 0) {
|
|
43
43
|
return [currentRef];
|
|
44
44
|
}
|
|
45
|
-
console.log('[useInteraction] resolveTargets:', { targetIds, targetMode });
|
|
46
45
|
const targetRefs = [];
|
|
47
46
|
// Add current object if mode is 'add'
|
|
48
47
|
if (targetMode === 'add') {
|
|
@@ -54,9 +53,6 @@ cameraSettings, sequences, }) {
|
|
|
54
53
|
if (obj) {
|
|
55
54
|
targetRefs.push(obj);
|
|
56
55
|
}
|
|
57
|
-
else {
|
|
58
|
-
console.warn(`[useInteraction] Target not found: ${id}`);
|
|
59
|
-
}
|
|
60
56
|
});
|
|
61
57
|
return targetRefs.length > 0 ? targetRefs : [currentRef];
|
|
62
58
|
}, []);
|
|
@@ -66,16 +62,11 @@ cameraSettings, sequences, }) {
|
|
|
66
62
|
const triggerAnimations = useCallback((animationIds) => {
|
|
67
63
|
if (!animationIds || animationIds.length === 0)
|
|
68
64
|
return;
|
|
69
|
-
console.log('[useInteraction] triggerAnimations:', animationIds);
|
|
70
|
-
console.log('Available sequences:', sequences.map(s => s.id));
|
|
71
65
|
animationIds.forEach(animationId => {
|
|
72
66
|
const sequence = sequences.find(s => s.id === animationId);
|
|
73
67
|
if (sequence) {
|
|
74
68
|
AnimationsManager.playSequence(sequence);
|
|
75
69
|
}
|
|
76
|
-
else {
|
|
77
|
-
console.warn(`[useInteraction] Sequence not found: ${animationId}`);
|
|
78
|
-
}
|
|
79
70
|
});
|
|
80
71
|
}, [sequences]);
|
|
81
72
|
// ===========================================================================
|
|
@@ -89,7 +80,6 @@ cameraSettings, sequences, }) {
|
|
|
89
80
|
const defaultDistance = 2.0;
|
|
90
81
|
const isCurrentlySelected = currentAnimatedRef.current !== null;
|
|
91
82
|
const isSameObject = currentAnimatedRef.current?.uuid === ref.uuid;
|
|
92
|
-
console.log('[useInteraction] executeOperation:', operation);
|
|
93
83
|
switch (operation) {
|
|
94
84
|
case 'vanish': {
|
|
95
85
|
if (isVanished(ref.uuid)) {
|
|
@@ -188,7 +178,6 @@ cameraSettings, sequences, }) {
|
|
|
188
178
|
mat.needsUpdate = true;
|
|
189
179
|
}
|
|
190
180
|
catch (err) {
|
|
191
|
-
console.error('[useInteraction] Failed to load texture:', err);
|
|
192
181
|
}
|
|
193
182
|
}
|
|
194
183
|
break;
|
|
@@ -198,10 +187,7 @@ cameraSettings, sequences, }) {
|
|
|
198
187
|
case 'delete':
|
|
199
188
|
case 'toggle':
|
|
200
189
|
case 'loadProject':
|
|
201
|
-
console.log(`[useInteraction] ${operation} - not implemented for scene interactions`);
|
|
202
190
|
break;
|
|
203
|
-
default:
|
|
204
|
-
console.warn(`[useInteraction] Unknown operation: ${operation}`);
|
|
205
191
|
}
|
|
206
192
|
}, [
|
|
207
193
|
isVanished,
|
|
@@ -222,7 +208,6 @@ cameraSettings, sequences, }) {
|
|
|
222
208
|
const executeOperations = useCallback((operations, ref, createdObject, textureUrl) => {
|
|
223
209
|
if (!operations || operations.length === 0)
|
|
224
210
|
return;
|
|
225
|
-
console.log('[useInteraction] executeOperations:', operations);
|
|
226
211
|
operations.forEach(operation => {
|
|
227
212
|
executeOperation(operation, ref, createdObject, textureUrl);
|
|
228
213
|
});
|
|
@@ -234,19 +219,9 @@ cameraSettings, sequences, }) {
|
|
|
234
219
|
const { interaction, ref, createdObject } = params;
|
|
235
220
|
if (!interaction.enabled)
|
|
236
221
|
return;
|
|
237
|
-
console.log('[useInteraction] executeInteraction:', {
|
|
238
|
-
mouseEvent: interaction.mouseEvent,
|
|
239
|
-
operations: interaction.operations,
|
|
240
|
-
targetIds: interaction.targetIds,
|
|
241
|
-
animationIds: interaction.animationIds
|
|
242
|
-
});
|
|
243
222
|
let textureUrl = undefined;
|
|
244
223
|
if (interaction.operations?.includes('displayImage')) {
|
|
245
|
-
console.log('Display Image interaction triggered:', {
|
|
246
|
-
ref,
|
|
247
|
-
});
|
|
248
224
|
textureUrl = ref.userData?.url;
|
|
249
|
-
console.log('Texture URL:', textureUrl);
|
|
250
225
|
}
|
|
251
226
|
// 1. Resolve target objects
|
|
252
227
|
const targets = resolveTargets(interaction, ref);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CreatedObjectSettings } from '@3driseai/3drise-core';
|
|
2
|
-
import {
|
|
2
|
+
import type { Object3DSource } from "../utils/resolveObject3D";
|
|
3
3
|
export interface UseInteractionEffectsOptions {
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
animateMaterial?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface UseInteractionEffectsResult {
|
|
8
8
|
}
|
|
9
|
-
export declare const useMouseMove: (objectSettings: CreatedObjectSettings | null, options
|
|
9
|
+
export declare const useMouseMove: (objectSettings: CreatedObjectSettings | null, options?: UseInteractionEffectsOptions, objectSource?: Object3DSource) => UseInteractionEffectsResult;
|
|
10
10
|
export default useMouseMove;
|
|
11
11
|
//# sourceMappingURL=useInteractionEffects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInteractionEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useInteractionEffects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useInteractionEffects.d.ts","sourceRoot":"","sources":["../../src/hooks/useInteractionEffects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,MAAM,WAAW,4BAA4B;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;CAC3C;AAqDD,eAAO,MAAM,YAAY,GAAI,gBAAgB,qBAAqB,GAAG,IAAI,EAAE,UAAS,4BAAiC,EAAE,eAAe,cAAc,KAAG,2BAqBtJ,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useFrame } from "@react-three/fiber";
|
|
2
2
|
import { detectAnimatableDomain, handleEdgesMouseMove, handleMaterialMouseMove, handleTransformMouseMove, } from '@3driseai/3drise-core';
|
|
3
|
+
import { resolveObject3D } from "../utils/resolveObject3D.js";
|
|
3
4
|
// =============================================================================
|
|
4
5
|
// FLAT-SHAPE BACK COMPAT
|
|
5
6
|
// =============================================================================
|
|
@@ -50,9 +51,10 @@ function resolveDomains(settings) {
|
|
|
50
51
|
// =============================================================================
|
|
51
52
|
// useMouseMove
|
|
52
53
|
// =============================================================================
|
|
53
|
-
export const useMouseMove = (objectSettings, options = {},
|
|
54
|
+
export const useMouseMove = (objectSettings, options = {}, objectSource) => {
|
|
54
55
|
const { enabled = true, animateMaterial = true } = options;
|
|
55
56
|
useFrame((state) => {
|
|
57
|
+
const object = resolveObject3D(objectSource);
|
|
56
58
|
if (!enabled || !object || !objectSettings)
|
|
57
59
|
return;
|
|
58
60
|
const domains = resolveDomains(objectSettings);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MaterialSettings } from '@3driseai/3drise-core';
|
|
2
|
-
import {
|
|
3
|
-
export declare const useMaterialApplication: (
|
|
2
|
+
import type { Object3DSource } from "../utils/resolveObject3D";
|
|
3
|
+
export declare const useMaterialApplication: (source: Object3DSource, materialSettings: MaterialSettings, shouldApply3driseMaterial?: boolean, onApplied?: () => void) => void;
|
|
4
4
|
//# sourceMappingURL=useMaterialApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMaterialApplication.d.ts","sourceRoot":"","sources":["../../src/hooks/useMaterialApplication.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useMaterialApplication.d.ts","sourceRoot":"","sources":["../../src/hooks/useMaterialApplication.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,eAAO,MAAM,sBAAsB,GAAI,QAAQ,cAAc,EAAE,kBAAkB,gBAAgB,EAAE,4BAA4B,OAAO,EAAE,YAAY,MAAM,IAAI,KAAG,IAqIhK,CAAC"}
|