@3driseai/3drise-viewer 0.1.25 → 0.1.26

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.
Files changed (116) hide show
  1. package/dist/animationsV2/ClipPlayer.d.ts +13 -0
  2. package/dist/animationsV2/ClipPlayer.d.ts.map +1 -0
  3. package/dist/animationsV2/ClipPlayer.js +140 -0
  4. package/dist/animationsV2/ClipsRuntime.d.ts +111 -0
  5. package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -0
  6. package/dist/animationsV2/ClipsRuntime.js +476 -0
  7. package/dist/animationsV2/appliers.d.ts +16 -0
  8. package/dist/animationsV2/appliers.d.ts.map +1 -0
  9. package/dist/animationsV2/appliers.js +204 -0
  10. package/dist/animationsV2/clipUtils.d.ts +33 -0
  11. package/dist/animationsV2/clipUtils.d.ts.map +1 -0
  12. package/dist/animationsV2/clipUtils.js +164 -0
  13. package/dist/animationsV2/elementSettings.d.ts +15 -0
  14. package/dist/animationsV2/elementSettings.d.ts.map +1 -0
  15. package/dist/animationsV2/elementSettings.js +16 -0
  16. package/dist/animationsV2/index.d.ts +16 -0
  17. package/dist/animationsV2/index.d.ts.map +1 -0
  18. package/dist/animationsV2/index.js +12 -0
  19. package/dist/animationsV2/nodeTracks.d.ts +13 -0
  20. package/dist/animationsV2/nodeTracks.d.ts.map +1 -0
  21. package/dist/animationsV2/nodeTracks.js +165 -0
  22. package/dist/animationsV2/normalize.d.ts +4 -0
  23. package/dist/animationsV2/normalize.d.ts.map +1 -0
  24. package/dist/animationsV2/normalize.js +49 -0
  25. package/dist/animationsV2/sequenceUtils.d.ts +57 -0
  26. package/dist/animationsV2/sequenceUtils.d.ts.map +1 -0
  27. package/dist/animationsV2/sequenceUtils.js +120 -0
  28. package/dist/animationsV2/types.d.ts +95 -0
  29. package/dist/animationsV2/types.d.ts.map +1 -0
  30. package/dist/animationsV2/types.js +8 -0
  31. package/dist/api/sceneHandle.d.ts +56 -17
  32. package/dist/api/sceneHandle.d.ts.map +1 -1
  33. package/dist/api/sceneHandle.js +154 -77
  34. package/dist/components/CameraController.d.ts.map +1 -1
  35. package/dist/components/CameraController.js +0 -44
  36. package/dist/components/Clouds.d.ts.map +1 -1
  37. package/dist/components/Clouds.js +0 -34
  38. package/dist/components/CreatedObject.d.ts.map +1 -1
  39. package/dist/components/CreatedObject.js +19 -1
  40. package/dist/components/EnvironmentManager.js +1 -1
  41. package/dist/components/ObjectsRenderer.d.ts +4 -1
  42. package/dist/components/ObjectsRenderer.d.ts.map +1 -1
  43. package/dist/components/ObjectsRenderer.js +23 -3
  44. package/dist/components/Ocean.d.ts.map +1 -1
  45. package/dist/components/Ocean.js +0 -63
  46. package/dist/components/SceneBuilder.d.ts.map +1 -1
  47. package/dist/components/SceneBuilder.js +19 -4
  48. package/dist/components/SkyController.d.ts.map +1 -1
  49. package/dist/components/SkyController.js +0 -39
  50. package/dist/components/Stars.d.ts.map +1 -1
  51. package/dist/components/Stars.js +3 -47
  52. package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
  53. package/dist/components/terrain/TerrainSurface.js +0 -5
  54. package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
  55. package/dist/components/volumetricClouds/VolumetricCloudsPass.js +0 -6
  56. package/dist/hooks/index.d.ts +0 -2
  57. package/dist/hooks/index.d.ts.map +1 -1
  58. package/dist/hooks/index.js +0 -2
  59. package/dist/hooks/useInteraction.d.ts +6 -7
  60. package/dist/hooks/useInteraction.d.ts.map +1 -1
  61. package/dist/hooks/useInteraction.js +87 -268
  62. package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
  63. package/dist/hooks/useObjectAnimation.js +0 -2
  64. package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
  65. package/dist/hooks/useOceanMaterial.js +0 -5
  66. package/dist/hooks/useRuntimeSettings.d.ts +1 -1
  67. package/dist/hooks/useRuntimeSettings.js +1 -1
  68. package/dist/index.d.ts +5 -2
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +3 -0
  71. package/dist/interactions/index.d.ts +3 -0
  72. package/dist/interactions/index.d.ts.map +1 -0
  73. package/dist/interactions/index.js +1 -0
  74. package/dist/interactions/runner.d.ts +9 -0
  75. package/dist/interactions/runner.d.ts.map +1 -0
  76. package/dist/interactions/runner.js +23 -0
  77. package/dist/operations/catalogue/displayImage.d.ts +3 -0
  78. package/dist/operations/catalogue/displayImage.d.ts.map +1 -0
  79. package/dist/operations/catalogue/displayImage.js +39 -0
  80. package/dist/operations/catalogue/fade.d.ts +3 -0
  81. package/dist/operations/catalogue/fade.d.ts.map +1 -0
  82. package/dist/operations/catalogue/fade.js +44 -0
  83. package/dist/operations/catalogue/focus.d.ts +3 -0
  84. package/dist/operations/catalogue/focus.d.ts.map +1 -0
  85. package/dist/operations/catalogue/focus.js +22 -0
  86. package/dist/operations/catalogue/glow.d.ts +3 -0
  87. package/dist/operations/catalogue/glow.d.ts.map +1 -0
  88. package/dist/operations/catalogue/glow.js +49 -0
  89. package/dist/operations/catalogue/materialFx.d.ts +6 -0
  90. package/dist/operations/catalogue/materialFx.d.ts.map +1 -0
  91. package/dist/operations/catalogue/materialFx.js +13 -0
  92. package/dist/operations/catalogue/moveToFront.d.ts +3 -0
  93. package/dist/operations/catalogue/moveToFront.d.ts.map +1 -0
  94. package/dist/operations/catalogue/moveToFront.js +25 -0
  95. package/dist/operations/catalogue/visibility.d.ts +3 -0
  96. package/dist/operations/catalogue/visibility.d.ts.map +1 -0
  97. package/dist/operations/catalogue/visibility.js +24 -0
  98. package/dist/operations/catalogue/zoom.d.ts +3 -0
  99. package/dist/operations/catalogue/zoom.d.ts.map +1 -0
  100. package/dist/operations/catalogue/zoom.js +32 -0
  101. package/dist/operations/index.d.ts +5 -0
  102. package/dist/operations/index.d.ts.map +1 -0
  103. package/dist/operations/index.js +4 -0
  104. package/dist/operations/registry.d.ts +11 -0
  105. package/dist/operations/registry.d.ts.map +1 -0
  106. package/dist/operations/registry.js +21 -0
  107. package/dist/operations/runtime.d.ts +22 -0
  108. package/dist/operations/runtime.d.ts.map +1 -0
  109. package/dist/operations/runtime.js +161 -0
  110. package/dist/operations/types.d.ts +96 -0
  111. package/dist/operations/types.d.ts.map +1 -0
  112. package/dist/operations/types.js +3 -0
  113. package/dist/operations/useOperationsRuntime.d.ts +3 -0
  114. package/dist/operations/useOperationsRuntime.d.ts.map +1 -0
  115. package/dist/operations/useOperationsRuntime.js +31 -0
  116. package/package.json +2 -2
@@ -1,283 +1,102 @@
1
1
  /**
2
- * useInteraction.ts
2
+ * useInteraction — runs an object's interactions.
3
3
  *
4
- * Hook for handling Interactions on scene objects.
5
- * Provides executeInteraction function and utility functions for:
6
- * - Resolving target objects
7
- * - Executing operations
8
- * - Triggering animations
4
+ * An interaction (core `Interaction`) is a trigger plus three kinds of reaction,
5
+ * run in this order:
6
+ *
7
+ * effects operations on their targets, through the shared operations runtime
8
+ * (../operations) — a triggered interaction toggles an operation that
9
+ * can be undone, and applies one that can't. 'self' = the object the
10
+ * interaction is on.
11
+ * animations play / pause / stop / toggle a clip or a sequence (ClipsRuntime).
12
+ * play starts from the beginning, or resumes if paused; toggle plays
13
+ * forward, then back — "back" is the opposite of a sequence's own
14
+ * reverse.
15
+ * actions apply / revert / toggle an action (SceneActions; its own effects
16
+ * run through the same runtime).
9
17
  */
10
- import { useCallback, useRef } from 'react';
11
- import { AnimationsManager, SceneActions, texturesManager } from '@3driseai/3drise-core';
12
- import useCameraAnimation from '../hooks/useCameraAnimation.js';
13
- import { useFrameAnimations } from '../hooks/useFrameAnimations.js';
14
- import { useObjectEffects } from '../hooks/useObjectEffects.js';
15
- import { findById } from '../utils/sceneQuery.js';
16
- // =============================================================================
17
- // TYPES
18
- // =============================================================================
19
- // =============================================================================
20
- // HOOK
21
- // =============================================================================
22
- export function useInteraction({
23
- // mode = 'default',
24
- cameraSettings, sequences, actionSequences = [], }) {
25
- // Redux state
26
- // Track currently animated object for toggle behavior
27
- const currentAnimatedRef = useRef(null);
28
- // Animation ids whose last toggle played forward — the next toggle plays them reversed.
29
- const toggledAnimationsRef = useRef(new Set());
30
- // Hooks
31
- const { animateCamera } = useCameraAnimation({
32
- autoAnimate: false,
33
- defaultDuration: 1,
34
- defaultEase: "power2.out"
35
- });
36
- const { moveToFront, zoomToFrame, restoreOriginalTransform, restoreCamera } = useFrameAnimations(cameraSettings);
37
- const { vanishObject, restoreVanishedObject, animateGlowEffect, removeGlow, isVanished, isGlowing, glowingObjects, vanishedObjects, } = useObjectEffects();
38
- // ===========================================================================
39
- // UTILITY: Resolve Target Objects
40
- // ===========================================================================
41
- const resolveTargets = useCallback((interaction, currentRef) => {
42
- const { targetIds, targetMode } = interaction;
43
- // If no targetIds specified, return current object only
44
- if (!targetIds || targetIds.length === 0) {
45
- return [currentRef];
46
- }
47
- const targetRefs = [];
48
- // Add current object if mode is 'add'
49
- if (targetMode === 'add') {
50
- targetRefs.push(currentRef);
51
- }
52
- // Lookup targets from scene
53
- targetIds.forEach(id => {
54
- const obj = findById(id);
55
- if (obj) {
56
- targetRefs.push(obj);
57
- }
58
- });
59
- return targetRefs.length > 0 ? targetRefs : [currentRef];
18
+ import { useCallback, useMemo, useRef } from 'react';
19
+ import { SceneActions } from '@3driseai/3drise-core';
20
+ import ClipsRuntime from '../animationsV2/ClipsRuntime.js';
21
+ import { clipMap } from '../animationsV2/sequenceUtils.js';
22
+ import { runEffect } from '../operations/runtime.js';
23
+ import { useOperationsRuntime } from '../operations/useOperationsRuntime.js';
24
+ export function useInteraction({ cameraSettings, sequences = [], clips = [], actionSequences = [], }) {
25
+ // The scene's operation tools (camera, bring-to-front…) for the shared runtime.
26
+ useOperationsRuntime(cameraSettings);
27
+ // Toggle state: animation ids whose last toggle went "forward".
28
+ const toggledRef = useRef(new Set());
29
+ const clipsById = useMemo(() => clipMap(clips), [clips]);
30
+ /** First trigger → forward (false), next → back (true), … per key. */
31
+ const nextIsBack = useCallback((key) => {
32
+ const toggled = toggledRef.current;
33
+ const back = toggled.has(key);
34
+ if (back)
35
+ toggled.delete(key);
36
+ else
37
+ toggled.add(key);
38
+ return back;
60
39
  }, []);
61
- // ===========================================================================
62
- // UTILITY: Trigger Animations
63
- // ===========================================================================
64
- // 'toggle' in an interaction's operations is a modifier, not an effect of its own:
65
- // it makes that interaction's animations and actions two-state. Animations play
66
- // forward then reversed; actions apply then revert (their patches are removed).
67
- const triggerAnimations = useCallback((animationIds, toggle = false) => {
68
- if (!animationIds || animationIds.length === 0)
40
+ // ---------------------------------------------------------------- run
41
+ const executeInteraction = useCallback((params) => {
42
+ const { interaction, ref } = params;
43
+ if (!interaction?.enabled)
69
44
  return;
70
- animationIds.forEach(animationId => {
71
- const sequence = sequences.find(s => s.id === animationId);
72
- if (!sequence)
73
- return;
74
- if (!toggle) {
75
- AnimationsManager.playSequence(sequence);
76
- return;
45
+ // 1. Effects — each on its own targets.
46
+ for (const effect of interaction.effects ?? [])
47
+ runEffect(effect, 'trigger', ref);
48
+ // 2. Animations.
49
+ for (const a of interaction.animations ?? []) {
50
+ if (a.kind === 'clip') {
51
+ const clip = clipsById.get(a.ref);
52
+ if (!clip)
53
+ continue;
54
+ if (a.command === 'pause')
55
+ ClipsRuntime.pause(clip.id);
56
+ else if (a.command === 'stop')
57
+ ClipsRuntime.stop(clip.id);
58
+ else if (a.command === 'toggle')
59
+ ClipsRuntime.play(clip, { reverse: nextIsBack(`clip:${clip.id}`) });
60
+ else if (ClipsRuntime.isActive(clip.id) && !ClipsRuntime.isPlaying(clip.id) && ClipsRuntime.getTime(clip.id) < clip.duration)
61
+ ClipsRuntime.resume(clip.id);
62
+ else
63
+ ClipsRuntime.play(clip, { from: 0 });
77
64
  }
78
- const toggled = toggledAnimationsRef.current;
79
- const reverse = toggled.has(animationId);
80
- if (reverse)
81
- toggled.delete(animationId);
82
- else
83
- toggled.add(animationId);
84
- AnimationsManager.playSequence(sequence, { reverse });
85
- });
86
- }, [sequences]);
87
- // ===========================================================================
88
- // UTILITY: Trigger Actions (instant)
89
- // ===========================================================================
90
- const triggerActions = useCallback((actionIds, toggle = false) => {
91
- if (!actionIds || actionIds.length === 0)
92
- return;
93
- actionIds.forEach(actionId => {
94
- const action = actionSequences.find(a => a.id === actionId);
95
- if (!action)
96
- return;
97
- if (toggle)
98
- SceneActions.toggleAction(action);
99
- else
100
- SceneActions.applyAction(action);
101
- });
102
- }, [actionSequences]);
103
- // ===========================================================================
104
- // UTILITY: Execute Single Operation
105
- // ===========================================================================
106
- const executeOperation = useCallback(async (operation, ref, createdObject, textureUrl) => {
107
- if (!operation || operation === 'none')
108
- return;
109
- const defaultDuration = 1.0;
110
- const defaultEase = "power2.out";
111
- const defaultDistance = 2.0;
112
- const isCurrentlySelected = currentAnimatedRef.current !== null;
113
- const isSameObject = currentAnimatedRef.current?.uuid === ref.uuid;
114
- switch (operation) {
115
- case 'vanish': {
116
- if (isVanished(ref.uuid)) {
117
- restoreVanishedObject(ref, defaultDuration, defaultEase);
65
+ else {
66
+ const seq = sequences.find(s => s.id === a.ref);
67
+ if (!seq)
68
+ continue;
69
+ if (a.command === 'pause')
70
+ ClipsRuntime.pauseSequence(seq.id);
71
+ else if (a.command === 'stop')
72
+ ClipsRuntime.stopSequence(seq.id);
73
+ else if (a.command === 'toggle') {
74
+ const back = nextIsBack(`seq:${seq.id}`);
75
+ ClipsRuntime.playSequence(seq, clipsById, { reverse: back ? !seq.reverse : seq.reverse });
118
76
  }
119
- else {
120
- vanishObject(ref, defaultDuration, defaultEase);
121
- }
122
- break;
123
- }
124
- case 'glow': {
125
- if (isGlowing(ref.uuid)) {
126
- removeGlow(ref);
77
+ else if (ClipsRuntime.isSequenceActive(seq.id) && !ClipsRuntime.isSequencePlaying(seq.id) && ClipsRuntime.getSequenceProgress(seq.id) < 1) {
78
+ ClipsRuntime.resumeSequence(seq.id);
127
79
  }
128
80
  else {
129
- animateGlowEffect(ref);
130
- }
131
- break;
132
- }
133
- case 'focus': {
134
- animateCamera({}, defaultDuration, defaultEase, createdObject.meshSettings.position);
135
- break;
136
- }
137
- case 'moveToFront': {
138
- // Toggle: if clicking the same object, restore it
139
- if (isCurrentlySelected && isSameObject) {
140
- restoreOriginalTransform(currentAnimatedRef.current, {
141
- duration: defaultDuration,
142
- ease: defaultEase
143
- });
144
- currentAnimatedRef.current = null;
145
- return;
146
- }
147
- // Restore previous object if different
148
- if (isCurrentlySelected && !isSameObject) {
149
- restoreOriginalTransform(currentAnimatedRef.current, {
150
- duration: defaultDuration,
151
- ease: defaultEase
152
- });
153
- }
154
- // Apply new animation
155
- moveToFront(ref, {
156
- distance: defaultDistance,
157
- scale: [6, 4],
158
- duration: defaultDuration,
159
- ease: defaultEase
160
- });
161
- currentAnimatedRef.current = ref;
162
- break;
163
- }
164
- case 'zoom': {
165
- // Toggle: if clicking the same object, restore camera
166
- if (isCurrentlySelected && isSameObject) {
167
- restoreCamera({ duration: defaultDuration, ease: defaultEase });
168
- currentAnimatedRef.current = null;
169
- return;
170
- }
171
- // Restore previous camera if different object
172
- if (isCurrentlySelected && !isSameObject) {
173
- restoreCamera({ duration: defaultDuration, ease: defaultEase });
174
- }
175
- // Apply new zoom
176
- zoomToFrame(ref, {
177
- distance: defaultDistance,
178
- duration: defaultDuration,
179
- ease: defaultEase
180
- });
181
- currentAnimatedRef.current = ref;
182
- break;
183
- }
184
- case 'playAnimation':
185
- // Handled by triggerAnimations
186
- break;
187
- case 'displayImage': {
188
- if (!textureUrl)
189
- break;
190
- let applier;
191
- let meshWithMap = null;
192
- ref.traverse((child) => {
193
- if (!applier && typeof child.userData?.applyTexture === 'function') {
194
- applier = child.userData.applyTexture;
195
- }
196
- else if (!meshWithMap && child.material) {
197
- meshWithMap = child;
198
- }
199
- });
200
- if (applier) {
201
- applier(textureUrl);
81
+ // From the start edge of its own direction.
82
+ const total = ClipsRuntime.getSequenceDuration(seq.id);
83
+ ClipsRuntime.playSequence(seq, clipsById, { from: seq.reverse && total > 0 ? total : 0 });
202
84
  }
203
- else if (meshWithMap) {
204
- const name = textureUrl.split('/').pop()?.split('.')[0] || `texture-${Date.now()}`;
205
- try {
206
- const loaded = await texturesManager.loadTexture(name, textureUrl, 'images');
207
- const mat = meshWithMap.material;
208
- mat.map = loaded;
209
- mat.needsUpdate = true;
210
- }
211
- catch (err) {
212
- }
213
- }
214
- break;
215
85
  }
216
- case 'toggle':
217
- // Modifier for animationIds/actionIds — handled in executeInteraction.
218
- break;
219
- case 'create':
220
- case 'update':
221
- case 'delete':
222
- case 'loadProject':
223
- break;
224
86
  }
225
- }, [
226
- isVanished,
227
- isGlowing,
228
- vanishObject,
229
- restoreVanishedObject,
230
- animateGlowEffect,
231
- removeGlow,
232
- animateCamera,
233
- moveToFront,
234
- zoomToFrame,
235
- restoreOriginalTransform,
236
- restoreCamera,
237
- ]);
238
- // ===========================================================================
239
- // UTILITY: Execute Multiple Operations
240
- // ===========================================================================
241
- const executeOperations = useCallback((operations, ref, createdObject, textureUrl) => {
242
- if (!operations || operations.length === 0)
243
- return;
244
- operations.forEach(operation => {
245
- executeOperation(operation, ref, createdObject, textureUrl);
246
- });
247
- }, [executeOperation]);
248
- // ===========================================================================
249
- // MAIN: Execute Interaction
250
- // ===========================================================================
251
- const executeInteraction = useCallback((params) => {
252
- const { interaction, ref, createdObject } = params;
253
- if (!interaction.enabled)
254
- return;
255
- let textureUrl = undefined;
256
- if (interaction.operations?.includes('displayImage')) {
257
- textureUrl = ref.userData?.url;
87
+ // 3. Actions.
88
+ for (const a of interaction.actions ?? []) {
89
+ const action = actionSequences.find(x => x.id === a.ref);
90
+ if (!action)
91
+ continue;
92
+ if (a.command === 'revert')
93
+ SceneActions.revertAction(action);
94
+ else if (a.command === 'toggle')
95
+ SceneActions.toggleAction(action);
96
+ else
97
+ SceneActions.applyAction(action);
258
98
  }
259
- // 1. Resolve target objects
260
- const targets = resolveTargets(interaction, ref);
261
- // 2. Execute operations on each target
262
- targets.forEach(targetRef => {
263
- // Find the createdObject for this target (if different from original)
264
- // For now, use the original createdObject for position data
265
- executeOperations(interaction.operations, targetRef, createdObject, textureUrl);
266
- });
267
- // 3. Trigger animations and actions ('toggle' makes both two-state)
268
- const toggle = interaction.operations?.includes('toggle') ?? false;
269
- triggerAnimations(interaction.animationIds, toggle);
270
- triggerActions(interaction.actionIds, toggle);
271
- }, [resolveTargets, executeOperations, triggerAnimations, triggerActions]);
272
- // ===========================================================================
273
- // RETURN
274
- // ===========================================================================
275
- return {
276
- executeInteraction,
277
- // Expose refs for context to share
278
- currentAnimatedRef,
279
- glowingObjects,
280
- vanishedObjects,
281
- };
99
+ }, [clipsById, sequences, actionSequences, nextIsBack]);
100
+ return { executeInteraction };
282
101
  }
283
102
  export default useInteraction;
@@ -1 +1 @@
1
- {"version":3,"file":"useObjectAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useObjectAnimation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,UAAU,yBAAyB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,wBAAyB,SAAQ,0BAA0B,EAAE,2BAA2B;CACjG;AAGD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,qBAAqB,GAAG,IAAI,EAAE,iBAAiB,OAAO,EAAE,UAAS,yBAA8B,EAAE,SAAS,cAAc,KAAG,wBAAwB,GAAG,IAexM,CAAC"}
1
+ {"version":3,"file":"useObjectAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useObjectAnimation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,UAAU,yBAAyB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,wBAAyB,SAAQ,0BAA0B,EAAE,2BAA2B;CACjG;AAGD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,qBAAqB,GAAG,IAAI,EAAE,iBAAiB,OAAO,EAAE,UAAS,yBAA8B,EAAE,SAAS,cAAc,KAAG,wBAAwB,GAAG,IAcxM,CAAC"}
@@ -3,7 +3,6 @@ import { useFrame } from '@react-three/fiber';
3
3
  import { findById } from '@3driseai/3drise-core';
4
4
  import { useContinuousEffects } from "./useContinuousEffects.js";
5
5
  import { useMouseMove } from "./useInteractionEffects.js";
6
- import { useSequenceAnimation } from "./useSequenceAnimation.js";
7
6
  /**
8
7
  * Drive every continuous animation for one scene object.
9
8
  *
@@ -28,6 +27,5 @@ export const useObjectAnimation = (objectSettings, animateMaterial, options = {}
28
27
  const source = object ?? fallbackRef;
29
28
  const continuousResult = useContinuousEffects(objectSettings, { enabled, animateMaterial, hovered }, source);
30
29
  const mouseMoveResult = useMouseMove(objectSettings, { enabled, animateMaterial }, source);
31
- useSequenceAnimation(objectSettings?.id, source);
32
30
  return { ...continuousResult, ...mouseMoveResult };
33
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useOceanMaterial.d.ts","sourceRoot":"","sources":["../../src/hooks/useOceanMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EA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kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE7E;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,uBAAuB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;gFAE4E;IAC5E,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACtF;AAED,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B;0DACsD;IACtD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,EAAE,EACF,MAAM,EACN,OAAO,EACP,WAAW,EACX,YAAY,EACZ,YAAgB,EAChB,OAAO,GACV,EAAE,uBAAuB,GAAG,mBAAmB,CAkE/C;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { useEffect, useMemo, useRef } from 'react';
2
2
  import { useFrame } from '@react-three/fiber';
3
3
  import { useCloudSun } from './useCloudSun.js';
4
- import { useLiveTransitionEvents } from './useLiveTransitionEvents.js';
5
4
  import { OCEAN_LIVE_KEY } from './useOceanLive.js';
6
5
  import { OceanSurfaceMaterial } from '../shaders/ocean/OceanSurfaceMaterial.js';
7
6
  import { applySunUniforms } from '../utils/cloudUniforms.js';
@@ -36,10 +35,6 @@ export function useOceanMaterial({ id, config, quality, skySettings, timeSetting
36
35
  root.userData[OCEAN_LIVE_KEY] = liveHandle;
37
36
  return () => { delete root.userData[OCEAN_LIVE_KEY]; };
38
37
  }, [id, liveHandle]);
39
- // Sequence-authored transitions (`transition.state === 'ocean'`) — shared by
40
- // both hosts (OceanSurface, WaterBody), the same way the material and the
41
- // live handle already are.
42
- useLiveTransitionEvents('ocean', liveConfig, config, rootRef);
43
38
  useFrame((state) => {
44
39
  const shader = material;
45
40
  updateSun();
@@ -2,7 +2,7 @@
2
2
  * An element's settings with any applied action patches laid over them.
3
3
  *
4
4
  * `state` is the element's action address: its object id, or 'camera' | 'sky' |
5
- * 'ocean' | 'clouds'. Subscribes to that one element only, so applying an action
5
+ * 'ocean' | 'clouds' | 'terrain'. Subscribes to that one element only, so applying an action
6
6
  * re-renders the elements it touches and nothing else. With no patch applied this
7
7
  * returns `base` itself — no copy, no identity change.
8
8
  *
@@ -5,7 +5,7 @@ const noopUnsubscribe = () => { };
5
5
  * An element's settings with any applied action patches laid over them.
6
6
  *
7
7
  * `state` is the element's action address: its object id, or 'camera' | 'sky' |
8
- * 'ocean' | 'clouds'. Subscribes to that one element only, so applying an action
8
+ * 'ocean' | 'clouds' | 'terrain'. Subscribes to that one element only, so applying an action
9
9
  * re-renders the elements it touches and nothing else. With no patch applied this
10
10
  * returns `base` itself — no copy, no identity change.
11
11
  *
package/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- export type { AnimationEvent, AnimationEventType, FontInfo } from '@3driseai/3drise-core';
1
+ export type { FontInfo } from '@3driseai/3drise-core';
2
2
  export { AnimationsManager as animationsManager, fontManager } from '@3driseai/3drise-core';
3
3
  export * from './types';
4
4
  export * from './components';
5
5
  export * from './hooks';
6
6
  export { createSceneHandle } from './api/sceneHandle';
7
- export type { SceneHandle, SceneHandleEvent, SceneHandleEventType, SceneActionInfo, SceneAnimationInfo, ScenePlayOptions } from './api/sceneHandle';
7
+ export * from './animationsV2';
8
+ export * from './interactions';
9
+ export * from './operations';
10
+ export type { SceneHandle, SceneHandleEvent, SceneHandleEventType, SceneActionInfo, SceneClipInfo, SceneSequenceInfo, ScenePlayOptions, ScenePlayback } from './api/sceneHandle';
8
11
  export type { PathAnimationOptions as PathAnimationHookOptions } from './hooks/usePathAnimation';
9
12
  export { cameraManager } from './utils/CameraSingleton';
10
13
  export { applyAnchorSettings, createCurves, createSunPosition, randomRange, } from './utils/utils3d';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG1F,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5F,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEpJ,YAAY,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAGjG,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,GAAG,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACvF,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7F,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAA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iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5F,cAAc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B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -8,6 +8,9 @@ export * from './components/index.js';
8
8
  export * from './hooks/index.js';
9
9
  // External control of a loaded project (ProjectLoader ref / onSceneReady)
10
10
  export { createSceneHandle } from './api/sceneHandle.js';
11
+ export * from './animationsV2/index.js';
12
+ export * from './interactions/index.js';
13
+ export * from './operations/index.js';
11
14
  // Utils
12
15
  export { cameraManager } from './utils/CameraSingleton.js';
13
16
  export { applyAnchorSettings, createCurves, createSunPosition, randomRange, } from './utils/utils3d.js';
@@ -0,0 +1,3 @@
1
+ export { runInteraction, setInteractionRunner, ObjectHoverContext } from './runner';
2
+ export type { ObjectHoverHandler } from './runner';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpF,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ export { runInteraction, setInteractionRunner, ObjectHoverContext } from './runner.js';
@@ -0,0 +1,9 @@
1
+ import type { CreatedObjectSettings, Interaction } from '@3driseai/3drise-core';
2
+ type Runner = (objectId: string, interaction: Interaction) => boolean;
3
+ export declare function setInteractionRunner(next: Runner): () => void;
4
+ /** Run an interaction now. False when no scene is mounted or the object is not there. */
5
+ export declare function runInteraction(objectId: string, interaction: Interaction): boolean;
6
+ export type ObjectHoverHandler = (createdObject: CreatedObjectSettings, ref: any, trigger: 'mouseEnter' | 'mouseLeave') => void;
7
+ export declare const ObjectHoverContext: import("react").Context<ObjectHoverHandler>;
8
+ export {};
9
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/interactions/runner.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEhF,KAAK,MAAM,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC;AAGtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,IAAI,CAG7D;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAElF;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,KAAK,IAAI,CAAC;AAChI,eAAO,MAAM,kBAAkB,6CAAiD,CAAC"}
@@ -0,0 +1,23 @@
1
+ // =============================================================================
2
+ // Interaction runner + hover bridge
3
+ // =============================================================================
4
+ //
5
+ // runInteraction(objectId, interaction) — run an interaction as if it were
6
+ // triggered (the studio's "Try it"). ObjectsRenderer registers the runner.
7
+ //
8
+ // ObjectHoverContext — ObjectsRenderer hands CreatedObject the hover handler, so
9
+ // 'mouseEnter' / 'mouseLeave' interactions fire without threading a prop through
10
+ // every renderer.
11
+ //
12
+ import { createContext } from 'react';
13
+ let runner = null;
14
+ export function setInteractionRunner(next) {
15
+ runner = next;
16
+ return () => { if (runner === next)
17
+ runner = null; };
18
+ }
19
+ /** Run an interaction now. False when no scene is mounted or the object is not there. */
20
+ export function runInteraction(objectId, interaction) {
21
+ return runner ? runner(objectId, interaction) : false;
22
+ }
23
+ export const ObjectHoverContext = createContext(null);
@@ -0,0 +1,3 @@
1
+ declare const _default: import("..").OperationDefinition;
2
+ export default _default;
3
+ //# sourceMappingURL=displayImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"displayImage.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/displayImage.ts"],"names":[],"mappings":";AAGA,wBA4BG"}
@@ -0,0 +1,39 @@
1
+ import { texturesManager } from '@3driseai/3drise-core';
2
+ import { defineOperation } from '../types.js';
3
+ export default defineOperation({
4
+ value: 'displayImage',
5
+ label: 'Show image',
6
+ description: "Show the clicked frame's image on the target",
7
+ multi: false,
8
+ toggles: false,
9
+ usableIn: ['interaction'],
10
+ galleryOnly: true,
11
+ async apply(target, _p, ctx) {
12
+ const url = ctx.self?.userData?.url;
13
+ if (!url)
14
+ return;
15
+ let applier;
16
+ let meshWithMap = null;
17
+ target.traverse((child) => {
18
+ if (!applier && typeof child.userData?.applyTexture === 'function')
19
+ applier = child.userData.applyTexture;
20
+ else if (!meshWithMap && child.material)
21
+ meshWithMap = child;
22
+ });
23
+ if (applier) {
24
+ applier(url);
25
+ return;
26
+ }
27
+ if (!meshWithMap)
28
+ return;
29
+ const name = url.split('/').pop()?.split('.')[0] || `texture-${Date.now()}`;
30
+ try {
31
+ const loaded = await texturesManager.loadTexture(name, url, 'images');
32
+ meshWithMap.material.map = loaded;
33
+ meshWithMap.material.needsUpdate = true;
34
+ }
35
+ catch {
36
+ // a missing image leaves the target as it was
37
+ }
38
+ },
39
+ });
@@ -0,0 +1,3 @@
1
+ declare const _default: import("..").OperationDefinition;
2
+ export default _default;
3
+ //# sourceMappingURL=fade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/fade.ts"],"names":[],"mappings":";AAMA,wBAoCG"}
@@ -0,0 +1,44 @@
1
+ import { gsap } from 'gsap';
2
+ import { defineOperation } from '../types.js';
3
+ import { forEachMaterial } from './materialFx.js';
4
+ const KEY = '__opFade';
5
+ export default defineOperation({
6
+ value: 'fade',
7
+ label: 'Fade out',
8
+ description: 'Fade the targets away (to a set opacity)',
9
+ multi: true,
10
+ toggles: true,
11
+ usableIn: ['interaction', 'action'],
12
+ params: {
13
+ opacity: { type: 'number', label: 'To opacity', default: 0, min: 0, max: 1, step: 0.05, hint: '0 hides the object when the fade ends' },
14
+ duration: { type: 'number', label: 'Duration', default: 1, min: 0, max: 10, step: 0.05, unit: 's' },
15
+ },
16
+ apply(target, p) {
17
+ const to = Number(p.opacity);
18
+ forEachMaterial(target, (mat) => {
19
+ if (!mat.userData[KEY])
20
+ mat.userData[KEY] = { opacity: mat.opacity, transparent: mat.transparent };
21
+ mat.transparent = true;
22
+ mat.needsUpdate = true;
23
+ gsap.killTweensOf(mat, 'opacity');
24
+ gsap.to(mat, {
25
+ opacity: to, duration: Number(p.duration), ease: 'power2.inOut',
26
+ onComplete: () => { if (to <= 0)
27
+ target.visible = false; },
28
+ });
29
+ });
30
+ },
31
+ revert(target, p) {
32
+ target.visible = true;
33
+ forEachMaterial(target, (mat) => {
34
+ const orig = mat.userData[KEY];
35
+ if (!orig)
36
+ return;
37
+ gsap.killTweensOf(mat, 'opacity');
38
+ gsap.to(mat, {
39
+ opacity: orig.opacity, duration: Number(p.duration), ease: 'power2.inOut',
40
+ onComplete: () => { mat.transparent = orig.transparent; mat.needsUpdate = true; delete mat.userData[KEY]; },
41
+ });
42
+ });
43
+ },
44
+ });