@3driseai/3drise-viewer 0.1.39 → 0.1.41
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/animationsV2/ClipsRuntime.d.ts +30 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +185 -14
- package/dist/animationsV2/clipUtils.d.ts +15 -0
- package/dist/animationsV2/clipUtils.d.ts.map +1 -1
- package/dist/animationsV2/clipUtils.js +39 -2
- package/dist/animationsV2/normalize.d.ts.map +1 -1
- package/dist/animationsV2/normalize.js +4 -0
- package/dist/animationsV2/types.d.ts +12 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/api/sceneHandle.d.ts +40 -3
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +40 -0
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +6 -2
- package/dist/components/EnabledContext.d.ts +12 -0
- package/dist/components/EnabledContext.d.ts.map +1 -0
- package/dist/components/EnabledContext.js +12 -0
- package/dist/components/GalleryObject.d.ts +13 -0
- package/dist/components/GalleryObject.d.ts.map +1 -0
- package/dist/components/GalleryObject.js +46 -0
- package/dist/components/ImageObject.d.ts +9 -0
- package/dist/components/ImageObject.d.ts.map +1 -0
- package/dist/components/ImageObject.js +26 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +17 -6
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +9 -0
- package/dist/components/ProjectLoader.d.ts +2 -0
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +2 -2
- package/dist/components/SceneBuilder.d.ts +10 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +3 -2
- package/dist/components/gallery/BasicCarouselGallery.d.ts +18 -0
- package/dist/components/gallery/BasicCarouselGallery.d.ts.map +1 -0
- package/dist/components/gallery/BasicCarouselGallery.js +9 -0
- package/dist/components/gallery/ContourLinesGallery.d.ts +18 -0
- package/dist/components/gallery/ContourLinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/ContourLinesGallery.js +9 -0
- package/dist/components/gallery/DepthLayersGallery.d.ts +18 -0
- package/dist/components/gallery/DepthLayersGallery.d.ts.map +1 -0
- package/dist/components/gallery/DepthLayersGallery.js +9 -0
- package/dist/components/gallery/EngravingGallery.d.ts +18 -0
- package/dist/components/gallery/EngravingGallery.d.ts.map +1 -0
- package/dist/components/gallery/EngravingGallery.js +9 -0
- package/dist/components/gallery/FlowLinesGallery.d.ts +18 -0
- package/dist/components/gallery/FlowLinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/FlowLinesGallery.js +9 -0
- package/dist/components/gallery/FoldGallery.d.ts +18 -0
- package/dist/components/gallery/FoldGallery.d.ts.map +1 -0
- package/dist/components/gallery/FoldGallery.js +9 -0
- package/dist/components/gallery/GlassPanesGallery.d.ts +18 -0
- package/dist/components/gallery/GlassPanesGallery.d.ts.map +1 -0
- package/dist/components/gallery/GlassPanesGallery.js +9 -0
- package/dist/components/gallery/HaloGallery.d.ts +18 -0
- package/dist/components/gallery/HaloGallery.d.ts.map +1 -0
- package/dist/components/gallery/HaloGallery.js +9 -0
- package/dist/components/gallery/LightThreadsGallery.d.ts +18 -0
- package/dist/components/gallery/LightThreadsGallery.d.ts.map +1 -0
- package/dist/components/gallery/LightThreadsGallery.js +9 -0
- package/dist/components/gallery/LoomGallery.d.ts +18 -0
- package/dist/components/gallery/LoomGallery.d.ts.map +1 -0
- package/dist/components/gallery/LoomGallery.js +9 -0
- package/dist/components/gallery/PaperLanternsGallery.d.ts +18 -0
- package/dist/components/gallery/PaperLanternsGallery.d.ts.map +1 -0
- package/dist/components/gallery/PaperLanternsGallery.js +9 -0
- package/dist/components/gallery/ParticleShiftGallery.d.ts +18 -0
- package/dist/components/gallery/ParticleShiftGallery.d.ts.map +1 -0
- package/dist/components/gallery/ParticleShiftGallery.js +9 -0
- package/dist/components/gallery/PinscreenGallery.d.ts +18 -0
- package/dist/components/gallery/PinscreenGallery.d.ts.map +1 -0
- package/dist/components/gallery/PinscreenGallery.js +9 -0
- package/dist/components/gallery/PopUpGallery.d.ts +18 -0
- package/dist/components/gallery/PopUpGallery.d.ts.map +1 -0
- package/dist/components/gallery/PopUpGallery.js +9 -0
- package/dist/components/gallery/PrismSplitGallery.d.ts +18 -0
- package/dist/components/gallery/PrismSplitGallery.d.ts.map +1 -0
- package/dist/components/gallery/PrismSplitGallery.js +9 -0
- package/dist/components/gallery/RidgelinesGallery.d.ts +18 -0
- package/dist/components/gallery/RidgelinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/RidgelinesGallery.js +9 -0
- package/dist/components/gallery/ShadowBoxGallery.d.ts +18 -0
- package/dist/components/gallery/ShadowBoxGallery.d.ts.map +1 -0
- package/dist/components/gallery/ShadowBoxGallery.js +9 -0
- package/dist/components/gallery/SilkGallery.d.ts +18 -0
- package/dist/components/gallery/SilkGallery.d.ts.map +1 -0
- package/dist/components/gallery/SilkGallery.js +9 -0
- package/dist/components/gallery/SlatsGallery.d.ts +18 -0
- package/dist/components/gallery/SlatsGallery.d.ts.map +1 -0
- package/dist/components/gallery/SlatsGallery.js +9 -0
- package/dist/components/gallery/StrataGallery.d.ts +18 -0
- package/dist/components/gallery/StrataGallery.d.ts.map +1 -0
- package/dist/components/gallery/StrataGallery.js +9 -0
- package/dist/components/gallery/TerracesGallery.d.ts +18 -0
- package/dist/components/gallery/TerracesGallery.d.ts.map +1 -0
- package/dist/components/gallery/TerracesGallery.js +9 -0
- package/dist/components/gallery/WireReliefGallery.d.ts +18 -0
- package/dist/components/gallery/WireReliefGallery.d.ts.map +1 -0
- package/dist/components/gallery/WireReliefGallery.js +9 -0
- package/dist/components/gallery/index.d.ts +46 -0
- package/dist/components/gallery/index.d.ts.map +1 -0
- package/dist/components/gallery/index.js +22 -0
- package/dist/components/gallery/kit/GalleryVariant.d.ts +68 -0
- package/dist/components/gallery/kit/GalleryVariant.d.ts.map +1 -0
- package/dist/components/gallery/kit/GalleryVariant.js +231 -0
- package/dist/components/gallery/kit/feeds.d.ts +7 -0
- package/dist/components/gallery/kit/feeds.d.ts.map +1 -0
- package/dist/components/gallery/kit/feeds.js +83 -0
- package/dist/components/gallery/kit/galleryKit.d.ts +118 -0
- package/dist/components/gallery/kit/galleryKit.d.ts.map +1 -0
- package/dist/components/gallery/kit/galleryKit.js +298 -0
- package/dist/components/gallery/kit/lookBase.d.ts +157 -0
- package/dist/components/gallery/kit/lookBase.d.ts.map +1 -0
- package/dist/components/gallery/kit/lookBase.js +211 -0
- package/dist/components/gallery/kit/pictures.d.ts +14 -0
- package/dist/components/gallery/kit/pictures.d.ts.map +1 -0
- package/dist/components/gallery/kit/pictures.js +81 -0
- package/dist/components/gallery/looks/basicCarousel.d.ts +177 -0
- package/dist/components/gallery/looks/basicCarousel.d.ts.map +1 -0
- package/dist/components/gallery/looks/basicCarousel.js +315 -0
- package/dist/components/gallery/looks/contourLines.d.ts +153 -0
- package/dist/components/gallery/looks/contourLines.d.ts.map +1 -0
- package/dist/components/gallery/looks/contourLines.js +91 -0
- package/dist/components/gallery/looks/depthLayers.d.ts +155 -0
- package/dist/components/gallery/looks/depthLayers.d.ts.map +1 -0
- package/dist/components/gallery/looks/depthLayers.js +87 -0
- package/dist/components/gallery/looks/engraving.d.ts +162 -0
- package/dist/components/gallery/looks/engraving.d.ts.map +1 -0
- package/dist/components/gallery/looks/engraving.js +96 -0
- package/dist/components/gallery/looks/flowLines.d.ts +180 -0
- package/dist/components/gallery/looks/flowLines.d.ts.map +1 -0
- package/dist/components/gallery/looks/flowLines.js +113 -0
- package/dist/components/gallery/looks/fold.d.ts +209 -0
- package/dist/components/gallery/looks/fold.d.ts.map +1 -0
- package/dist/components/gallery/looks/fold.js +155 -0
- package/dist/components/gallery/looks/glassPanes.d.ts +133 -0
- package/dist/components/gallery/looks/glassPanes.d.ts.map +1 -0
- package/dist/components/gallery/looks/glassPanes.js +208 -0
- package/dist/components/gallery/looks/halo.d.ts +100 -0
- package/dist/components/gallery/looks/halo.d.ts.map +1 -0
- package/dist/components/gallery/looks/halo.js +119 -0
- package/dist/components/gallery/looks/lightThreads.d.ts +199 -0
- package/dist/components/gallery/looks/lightThreads.d.ts.map +1 -0
- package/dist/components/gallery/looks/lightThreads.js +246 -0
- package/dist/components/gallery/looks/loom.d.ts +238 -0
- package/dist/components/gallery/looks/loom.d.ts.map +1 -0
- package/dist/components/gallery/looks/loom.js +256 -0
- package/dist/components/gallery/looks/paperLanterns.d.ts +181 -0
- package/dist/components/gallery/looks/paperLanterns.d.ts.map +1 -0
- package/dist/components/gallery/looks/paperLanterns.js +399 -0
- package/dist/components/gallery/looks/particleShift.d.ts +193 -0
- package/dist/components/gallery/looks/particleShift.d.ts.map +1 -0
- package/dist/components/gallery/looks/particleShift.js +282 -0
- package/dist/components/gallery/looks/pinscreen.d.ts +175 -0
- package/dist/components/gallery/looks/pinscreen.d.ts.map +1 -0
- package/dist/components/gallery/looks/pinscreen.js +96 -0
- package/dist/components/gallery/looks/popUp.d.ts +206 -0
- package/dist/components/gallery/looks/popUp.d.ts.map +1 -0
- package/dist/components/gallery/looks/popUp.js +132 -0
- package/dist/components/gallery/looks/prismSplit.d.ts +151 -0
- package/dist/components/gallery/looks/prismSplit.d.ts.map +1 -0
- package/dist/components/gallery/looks/prismSplit.js +84 -0
- package/dist/components/gallery/looks/ridgelines.d.ts +179 -0
- package/dist/components/gallery/looks/ridgelines.d.ts.map +1 -0
- package/dist/components/gallery/looks/ridgelines.js +111 -0
- package/dist/components/gallery/looks/shadowBox.d.ts +152 -0
- package/dist/components/gallery/looks/shadowBox.d.ts.map +1 -0
- package/dist/components/gallery/looks/shadowBox.js +82 -0
- package/dist/components/gallery/looks/silk.d.ts +140 -0
- package/dist/components/gallery/looks/silk.d.ts.map +1 -0
- package/dist/components/gallery/looks/silk.js +346 -0
- package/dist/components/gallery/looks/slats.d.ts +176 -0
- package/dist/components/gallery/looks/slats.d.ts.map +1 -0
- package/dist/components/gallery/looks/slats.js +93 -0
- package/dist/components/gallery/looks/strata.d.ts +172 -0
- package/dist/components/gallery/looks/strata.d.ts.map +1 -0
- package/dist/components/gallery/looks/strata.js +88 -0
- package/dist/components/gallery/looks/terraces.d.ts +168 -0
- package/dist/components/gallery/looks/terraces.d.ts.map +1 -0
- package/dist/components/gallery/looks/terraces.js +91 -0
- package/dist/components/gallery/looks/wireRelief.d.ts +153 -0
- package/dist/components/gallery/looks/wireRelief.d.ts.map +1 -0
- package/dist/components/gallery/looks/wireRelief.js +128 -0
- package/dist/components/image/ContourImage.d.ts +7 -0
- package/dist/components/image/ContourImage.d.ts.map +1 -0
- package/dist/components/image/ContourImage.js +6 -0
- package/dist/components/image/EngravingImage.d.ts +7 -0
- package/dist/components/image/EngravingImage.d.ts.map +1 -0
- package/dist/components/image/EngravingImage.js +6 -0
- package/dist/components/image/FrostImage.d.ts +7 -0
- package/dist/components/image/FrostImage.d.ts.map +1 -0
- package/dist/components/image/FrostImage.js +6 -0
- package/dist/components/image/LenticularImage.d.ts +7 -0
- package/dist/components/image/LenticularImage.d.ts.map +1 -0
- package/dist/components/image/LenticularImage.js +6 -0
- package/dist/components/image/PinscreenImage.d.ts +7 -0
- package/dist/components/image/PinscreenImage.d.ts.map +1 -0
- package/dist/components/image/PinscreenImage.js +6 -0
- package/dist/components/image/PrismImage.d.ts +7 -0
- package/dist/components/image/PrismImage.d.ts.map +1 -0
- package/dist/components/image/PrismImage.js +6 -0
- package/dist/components/image/ProjectorImage.d.ts +7 -0
- package/dist/components/image/ProjectorImage.d.ts.map +1 -0
- package/dist/components/image/ProjectorImage.js +6 -0
- package/dist/components/image/ReliefImage.d.ts +7 -0
- package/dist/components/image/ReliefImage.d.ts.map +1 -0
- package/dist/components/image/ReliefImage.js +6 -0
- package/dist/components/image/RollImage.d.ts +7 -0
- package/dist/components/image/RollImage.d.ts.map +1 -0
- package/dist/components/image/RollImage.js +6 -0
- package/dist/components/image/ShardsImage.d.ts +126 -0
- package/dist/components/image/ShardsImage.d.ts.map +1 -0
- package/dist/components/image/ShardsImage.js +470 -0
- package/dist/components/image/core/contour.d.ts +126 -0
- package/dist/components/image/core/contour.d.ts.map +1 -0
- package/dist/components/image/core/contour.js +123 -0
- package/dist/components/image/core/engraving.d.ts +135 -0
- package/dist/components/image/core/engraving.d.ts.map +1 -0
- package/dist/components/image/core/engraving.js +163 -0
- package/dist/components/image/core/frost.d.ts +126 -0
- package/dist/components/image/core/frost.d.ts.map +1 -0
- package/dist/components/image/core/frost.js +156 -0
- package/dist/components/image/core/imageCore.d.ts +110 -0
- package/dist/components/image/core/imageCore.d.ts.map +1 -0
- package/dist/components/image/core/imageCore.js +269 -0
- package/dist/components/image/core/lenticular.d.ts +129 -0
- package/dist/components/image/core/lenticular.d.ts.map +1 -0
- package/dist/components/image/core/lenticular.js +132 -0
- package/dist/components/image/core/pinscreen.d.ts +126 -0
- package/dist/components/image/core/pinscreen.d.ts.map +1 -0
- package/dist/components/image/core/pinscreen.js +147 -0
- package/dist/components/image/core/prism.d.ts +120 -0
- package/dist/components/image/core/prism.d.ts.map +1 -0
- package/dist/components/image/core/prism.js +164 -0
- package/dist/components/image/core/projector.d.ts +135 -0
- package/dist/components/image/core/projector.d.ts.map +1 -0
- package/dist/components/image/core/projector.js +225 -0
- package/dist/components/image/core/relief.d.ts +111 -0
- package/dist/components/image/core/relief.d.ts.map +1 -0
- package/dist/components/image/core/relief.js +94 -0
- package/dist/components/image/core/roll.d.ts +114 -0
- package/dist/components/image/core/roll.d.ts.map +1 -0
- package/dist/components/image/core/roll.js +116 -0
- package/dist/components/image/imageVariant.d.ts +46 -0
- package/dist/components/image/imageVariant.d.ts.map +1 -0
- package/dist/components/image/imageVariant.js +128 -0
- package/dist/components/image/index.d.ts +22 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +10 -0
- package/dist/components/image/pictureCycle.d.ts +15 -0
- package/dist/components/image/pictureCycle.d.ts.map +1 -0
- package/dist/components/image/pictureCycle.js +82 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +9 -7
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.js +39 -27
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -5
- package/dist/galleryRuntime.d.ts +57 -0
- package/dist/galleryRuntime.d.ts.map +1 -0
- package/dist/galleryRuntime.js +105 -0
- package/dist/hooks/useConfigLive.d.ts +1 -1
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/keyPad/KeyPadControls.d.ts +16 -0
- package/dist/keyPad/KeyPadControls.d.ts.map +1 -0
- package/dist/keyPad/KeyPadControls.js +176 -0
- package/dist/keyPad/index.d.ts +16 -0
- package/dist/keyPad/index.d.ts.map +1 -0
- package/dist/keyPad/index.js +8 -0
- package/dist/keyPad/keyBindings.d.ts +43 -0
- package/dist/keyPad/keyBindings.d.ts.map +1 -0
- package/dist/keyPad/keyBindings.js +92 -0
- package/dist/keyPad/keyPadAnimation.d.ts +28 -0
- package/dist/keyPad/keyPadAnimation.d.ts.map +1 -0
- package/dist/keyPad/keyPadAnimation.js +131 -0
- package/dist/keyPad/keyPadMotion.d.ts +68 -0
- package/dist/keyPad/keyPadMotion.d.ts.map +1 -0
- package/dist/keyPad/keyPadMotion.js +283 -0
- package/dist/keyPad/keyPadStore.d.ts +25 -0
- package/dist/keyPad/keyPadStore.d.ts.map +1 -0
- package/dist/keyPad/keyPadStore.js +63 -0
- package/dist/keyPad/types.d.ts +23 -0
- package/dist/keyPad/types.d.ts.map +1 -0
- package/dist/keyPad/types.js +9 -0
- package/dist/operations/catalogue/motionTrail.d.ts.map +1 -1
- package/dist/operations/catalogue/motionTrail.js +8 -1
- package/dist/operations/catalogue/visibility.d.ts.map +1 -1
- package/dist/operations/catalogue/visibility.js +23 -1
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts +2 -1
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts.map +1 -1
- package/dist/shaders/clouds/CloudResolveMaterial.js +37 -12
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts +4 -0
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts.map +1 -1
- package/dist/shaders/clouds/CloudVolumeMaterial.js +15 -3
- package/dist/triggers/kinds/gallery.d.ts +2 -0
- package/dist/triggers/kinds/gallery.d.ts.map +1 -0
- package/dist/triggers/kinds/gallery.js +39 -0
- package/dist/triggers/kinds/index.d.ts +1 -0
- package/dist/triggers/kinds/index.d.ts.map +1 -1
- package/dist/triggers/kinds/index.js +1 -0
- package/dist/ui/UiAnchorUpdater.d.ts.map +1 -1
- package/dist/ui/UiAnchorUpdater.js +2 -1
- package/dist/utils/cursorPicking.d.ts.map +1 -1
- package/dist/utils/cursorPicking.js +2 -1
- package/dist/utils/shownInScene.d.ts +13 -0
- package/dist/utils/shownInScene.d.ts.map +1 -0
- package/dist/utils/shownInScene.js +16 -0
- package/package.json +2 -2
|
@@ -18,6 +18,16 @@ export interface RuntimeEvent {
|
|
|
18
18
|
}
|
|
19
19
|
/** @deprecated name kept for existing imports */
|
|
20
20
|
export type ClipEvent = RuntimeEvent;
|
|
21
|
+
/**
|
|
22
|
+
* Blends: a property never jumps when a driver takes it over or lets it go. When a continuous
|
|
23
|
+
* track first wins a property, the runtime remembers where the property IS (the last value it
|
|
24
|
+
* wrote, else the live value, else the authored one) and for `blend` seconds writes a mix from
|
|
25
|
+
* there to the track's value; when every driver lets the property go, it glides back to the
|
|
26
|
+
* authored value the same way. So a project whose saved objects sit elsewhere than a sequence's
|
|
27
|
+
* first keys, a sequence first posed mid-way (a scroll story on a reload), a clip started while
|
|
28
|
+
* another one holds the property, or a clip stopped mid-move - none of them cut.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_BLEND = 0.35;
|
|
21
31
|
/**
|
|
22
32
|
* How a cue switches (apply / revert) or fires its subject. The triggers engine installs one,
|
|
23
33
|
* so cues run through it with the clip or sequence as their source. Returns false when an
|
|
@@ -46,6 +56,21 @@ declare class ClipsRuntime {
|
|
|
46
56
|
private eventListeners;
|
|
47
57
|
/** tracks whose authored value must be written back on the next tick */
|
|
48
58
|
private pendingRestore;
|
|
59
|
+
/** Blend-ins in flight, per property (see Blend). */
|
|
60
|
+
private blends;
|
|
61
|
+
/** Blend-outs in flight, per property: written by the tick until done. */
|
|
62
|
+
private blendOuts;
|
|
63
|
+
/** Runtime seconds (frame deltas), the clock the blends run on. */
|
|
64
|
+
private clock;
|
|
65
|
+
/** Blend seconds of the driver that last wrote each property (for its blend-out). */
|
|
66
|
+
private blendOf;
|
|
67
|
+
/** Next tick writes every winner even if unchanged (an edited clip). */
|
|
68
|
+
private forceWrite;
|
|
69
|
+
/** Diagnostics: keys written last tick, and keys written for the FIRST time last tick. */
|
|
70
|
+
private lastWritten;
|
|
71
|
+
private lastFirstWrites;
|
|
72
|
+
private everWritten;
|
|
73
|
+
private tickCost;
|
|
49
74
|
/** last written value per property (targetKey -> JSON) */
|
|
50
75
|
private written;
|
|
51
76
|
/** Discrete values laid last tick, per element (JSON) — to see which elements changed. */
|
|
@@ -70,6 +95,11 @@ declare class ClipsRuntime {
|
|
|
70
95
|
setLiveValue(state: string, path: string, value: KeyValue, node?: string): boolean;
|
|
71
96
|
/** What was last written by `setLiveValue`, else the authored value (action patches included). */
|
|
72
97
|
getLiveValue(state: string, path: string, node?: string): KeyValue | undefined;
|
|
98
|
+
/** Diagnostics: a write whose speed differs sharply from the previous frame's (a velocity discontinuity), per property. */
|
|
99
|
+
private lastSpeed;
|
|
100
|
+
private probeJump;
|
|
101
|
+
/** Where a property is right now: the last value the runtime wrote, else the live / authored value. */
|
|
102
|
+
private currentValue;
|
|
73
103
|
/** Whether `setLiveValue` can write this path (it has an applier). */
|
|
74
104
|
canSetLiveValue(state: string, path: string): boolean;
|
|
75
105
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipsRuntime.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipsRuntime.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ClipsRuntime.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipsRuntime.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1E,OAAO,EAA8E,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3H,OAAO,EAEL,KAAK,UAAU,EAAE,KAAK,aAAa,EAEpC,MAAM,iBAAiB,CAAC;AAkDzB,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAKxD,MAAM,WAAW,YAAY;IAAG,IAAI,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,UAAU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AS;IA2CjB,OAAO,CAAC,SAAS;IAKjB,6DAA6D;IAC7D,OAAO,CAAC,QAAQ;IAOhB,oFAAoF;IACpF,OAAO,CAAC,QAAQ;IAWhB,kGAAkG;IAClG,OAAO,CAAC,YAAY;IAepB,mEAAmE;IACnE,OAAO,CAAC,WAAW;IAKnB,iEAAiE;IACjE,OAAO,CAAC,cAAc;IAKtB,mEAAmE;IACnE,OAAO,CAAE,SAAS;IAqBlB,OAAO,CAAC,WAAW;IAqCnB,0EAA0E;IAC1E,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,UAAU;IAOlB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAwCvB,OAAO,CAAC,cAAc;IAQtB,gFAAgF;IAChF,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;IAKZ,0DAA0D;IAC1D,OAAO,CAAC,SAAS;CAKlB;AAeD,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,QAAA,MAAM,YAAY,cAAqB,CAAC;AACxC,eAAe,YAAY,CAAC"}
|
|
@@ -41,12 +41,38 @@
|
|
|
41
41
|
//
|
|
42
42
|
import { SceneActions, expandMaterialVariant } from '@3driseai/3drise-core';
|
|
43
43
|
import { logTrigger } from '../triggers/log.js';
|
|
44
|
-
import { getAtPath, sampleTrack } from './clipUtils.js';
|
|
44
|
+
import { getAtPath, isSwitchTrack, sampleTrack } from './clipUtils.js';
|
|
45
|
+
import { interpolateValue } from '@3driseai/3drise-core';
|
|
45
46
|
import { applyValue, clearApplierCaches, isApplicable, isTargetMounted, releaseLive } from './appliers.js';
|
|
46
47
|
import { readNodeValue, restoreNodeTrack } from './nodeTracks.js';
|
|
47
48
|
import { cueStatesAt, entryLocalTime, isEntryActive, resolveSequence, cueCommand, clipCueSchedule, firedBetween, } from './sequenceUtils.js';
|
|
48
49
|
/** Longest an autoplaying sequence waits for its targets. */
|
|
49
50
|
const MAX_TARGET_WAIT_MS = 8000;
|
|
51
|
+
/** A saved playback rate: positive and finite, else 1. */
|
|
52
|
+
const rate = (s) => (typeof s === 'number' && Number.isFinite(s) && s > 0 ? s : 1);
|
|
53
|
+
/**
|
|
54
|
+
* Blends: a property never jumps when a driver takes it over or lets it go. When a continuous
|
|
55
|
+
* track first wins a property, the runtime remembers where the property IS (the last value it
|
|
56
|
+
* wrote, else the live value, else the authored one) and for `blend` seconds writes a mix from
|
|
57
|
+
* there to the track's value; when every driver lets the property go, it glides back to the
|
|
58
|
+
* authored value the same way. So a project whose saved objects sit elsewhere than a sequence's
|
|
59
|
+
* first keys, a sequence first posed mid-way (a scroll story on a reload), a clip started while
|
|
60
|
+
* another one holds the property, or a clip stopped mid-move - none of them cut.
|
|
61
|
+
*/
|
|
62
|
+
export const DEFAULT_BLEND = 0.35;
|
|
63
|
+
const smooth = (t) => t * t * (3 - 2 * t);
|
|
64
|
+
const canBlend = (v) => typeof v === 'number' || (typeof v === 'string' && /^#[0-9a-f]{6}$/i.test(v)) || (Array.isArray(v) && v.every(x => typeof x === 'number'));
|
|
65
|
+
function mixValues(path, a, b, p) {
|
|
66
|
+
if (p <= 0)
|
|
67
|
+
return a;
|
|
68
|
+
if (p >= 1)
|
|
69
|
+
return b;
|
|
70
|
+
if (!canBlend(a) || !canBlend(b) || typeof a !== typeof b || (Array.isArray(a) !== Array.isArray(b)))
|
|
71
|
+
return b;
|
|
72
|
+
if (Array.isArray(a) && Array.isArray(b) && a.length !== b.length)
|
|
73
|
+
return b;
|
|
74
|
+
return interpolateValue(path.split('.').pop() ?? path, a, b, p);
|
|
75
|
+
}
|
|
50
76
|
/** The SceneActions layer discrete tracks are set through. */
|
|
51
77
|
const TIMELINE_LAYER = 'timeline';
|
|
52
78
|
/** Frames a changed element's continuous tracks are re-written for (its re-render may rebuild their target). */
|
|
@@ -81,6 +107,21 @@ class ClipsRuntime {
|
|
|
81
107
|
eventListeners = new Set();
|
|
82
108
|
/** tracks whose authored value must be written back on the next tick */
|
|
83
109
|
pendingRestore = [];
|
|
110
|
+
/** Blend-ins in flight, per property (see Blend). */
|
|
111
|
+
blends = new Map();
|
|
112
|
+
/** Blend-outs in flight, per property: written by the tick until done. */
|
|
113
|
+
blendOuts = new Map();
|
|
114
|
+
/** Runtime seconds (frame deltas), the clock the blends run on. */
|
|
115
|
+
clock = 0;
|
|
116
|
+
/** Blend seconds of the driver that last wrote each property (for its blend-out). */
|
|
117
|
+
blendOf = new Map();
|
|
118
|
+
/** Next tick writes every winner even if unchanged (an edited clip). */
|
|
119
|
+
forceWrite = false;
|
|
120
|
+
/** Diagnostics: keys written last tick, and keys written for the FIRST time last tick. */
|
|
121
|
+
lastWritten = [];
|
|
122
|
+
lastFirstWrites = [];
|
|
123
|
+
everWritten = new Set();
|
|
124
|
+
tickCost = 0;
|
|
84
125
|
/** last written value per property (targetKey -> JSON) */
|
|
85
126
|
written = new Map();
|
|
86
127
|
/** Discrete values laid last tick, per element (JSON) — to see which elements changed. */
|
|
@@ -150,6 +191,49 @@ class ClipsRuntime {
|
|
|
150
191
|
return undefined;
|
|
151
192
|
return getAtPath(this.ctx.getSettings(state), path);
|
|
152
193
|
}
|
|
194
|
+
/** Diagnostics: a write whose speed differs sharply from the previous frame's (a velocity discontinuity), per property. */
|
|
195
|
+
lastSpeed = new Map();
|
|
196
|
+
probeJump(key, prevJson, value, dt) {
|
|
197
|
+
if (prevJson === undefined)
|
|
198
|
+
return;
|
|
199
|
+
let prev;
|
|
200
|
+
try {
|
|
201
|
+
prev = JSON.parse(prevJson);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const num = (v) => typeof v === 'number' ? [v] : Array.isArray(v) && v.every(x => typeof x === 'number') ? v : null;
|
|
207
|
+
const a = num(prev), b = num(value);
|
|
208
|
+
if (!a || !b || a.length !== b.length || dt <= 0)
|
|
209
|
+
return;
|
|
210
|
+
const d = Math.max(...a.map((x, i) => Math.abs(b[i] - x)));
|
|
211
|
+
const speed = d / dt;
|
|
212
|
+
const last = this.lastSpeed.get(key);
|
|
213
|
+
this.lastSpeed.set(key, speed);
|
|
214
|
+
if (last === undefined || last < 1e-4)
|
|
215
|
+
return;
|
|
216
|
+
const ratio = speed / last;
|
|
217
|
+
if (ratio > 2.5 || ratio < 0.4)
|
|
218
|
+
this.dlog('JUMP', key, { from: prev, to: value, speedWas: +last.toFixed(4), speedNow: +speed.toFixed(4), dt: +dt.toFixed(4), at: this.clock.toFixed(3) });
|
|
219
|
+
}
|
|
220
|
+
/** Where a property is right now: the last value the runtime wrote, else the live / authored value. */
|
|
221
|
+
currentValue(state, path, node) {
|
|
222
|
+
const key = targetKey(state, node, path);
|
|
223
|
+
const out = this.blendOuts.get(key);
|
|
224
|
+
if (out) {
|
|
225
|
+
const u = out.duration > 0 ? (this.clock - out.start) / out.duration : 1;
|
|
226
|
+
return mixValues(path, out.from, out.to, smooth(Math.min(1, u)));
|
|
227
|
+
}
|
|
228
|
+
const w = this.written.get(key);
|
|
229
|
+
if (w !== undefined) {
|
|
230
|
+
try {
|
|
231
|
+
return JSON.parse(w);
|
|
232
|
+
}
|
|
233
|
+
catch { /* fall through */ }
|
|
234
|
+
}
|
|
235
|
+
return this.getLiveValue(state, path, node);
|
|
236
|
+
}
|
|
153
237
|
/** Whether `setLiveValue` can write this path (it has an applier). */
|
|
154
238
|
canSetLiveValue(state, path) {
|
|
155
239
|
return isApplicable(state, path);
|
|
@@ -219,6 +303,9 @@ class ClipsRuntime {
|
|
|
219
303
|
this.clips.clear();
|
|
220
304
|
this.sequences.clear();
|
|
221
305
|
this.pendingRestore = [];
|
|
306
|
+
this.blends.clear();
|
|
307
|
+
this.blendOuts.clear();
|
|
308
|
+
this.blendOf.clear();
|
|
222
309
|
this.written.clear();
|
|
223
310
|
this.laid.clear();
|
|
224
311
|
this.rewrite.clear();
|
|
@@ -294,7 +381,7 @@ class ClipsRuntime {
|
|
|
294
381
|
this.pendingRestore.push(...removed);
|
|
295
382
|
inst.clip = clip;
|
|
296
383
|
inst.time = Math.min(inst.time, clip.duration);
|
|
297
|
-
this.
|
|
384
|
+
this.forceWrite = true; // values may have changed under the same time (the written marks stay: no spurious blend-ins)
|
|
298
385
|
this.bumpState();
|
|
299
386
|
}
|
|
300
387
|
/**
|
|
@@ -518,6 +605,17 @@ class ClipsRuntime {
|
|
|
518
605
|
return;
|
|
519
606
|
}
|
|
520
607
|
const dt = Math.min(delta, 0.1);
|
|
608
|
+
this.clock += dt;
|
|
609
|
+
const tickStart = this.debug ? performance.now() : 0;
|
|
610
|
+
if (this.debug) {
|
|
611
|
+
const t = this.tickCost;
|
|
612
|
+
if (t > 8)
|
|
613
|
+
this.dlog('slow tick (previous)', { ms: +t.toFixed(1), at: this.clock.toFixed(3) });
|
|
614
|
+
}
|
|
615
|
+
if (this.debug && delta > 0.028)
|
|
616
|
+
this.dlog('long frame', { delta: +delta.toFixed(3), at: this.clock.toFixed(3), writtenLastTick: this.lastWritten.slice(0, 40), firstWrites: this.lastFirstWrites });
|
|
617
|
+
this.lastWritten = [];
|
|
618
|
+
this.lastFirstWrites = [];
|
|
521
619
|
let anyPlaying = false;
|
|
522
620
|
for (const inst of [...this.clips.values()]) {
|
|
523
621
|
const prev = inst.time;
|
|
@@ -601,22 +699,70 @@ class ClipsRuntime {
|
|
|
601
699
|
else
|
|
602
700
|
this.laid.delete(state);
|
|
603
701
|
this.rewrite.set(state, REWRITE_FRAMES);
|
|
702
|
+
this.dlog('layer changed (element re-renders)', state, { at: this.clock.toFixed(3), patch: layer[state] });
|
|
604
703
|
// Switch tracks over an action / Change cue setting the same thing: reported, not resolved.
|
|
605
704
|
if (json)
|
|
606
705
|
this.noteLayerClash(state, layer[state]);
|
|
607
706
|
}
|
|
608
707
|
SceneActions.setLayer(TIMELINE_LAYER, layer);
|
|
708
|
+
// Released properties gliding back to authored (a winner for the same property takes over).
|
|
709
|
+
for (const [key, b] of this.blendOuts) {
|
|
710
|
+
if (winners.has(key)) {
|
|
711
|
+
this.blendOuts.delete(key);
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
const u = b.duration > 0 ? (this.clock - b.start) / b.duration : 1;
|
|
715
|
+
const v = mixValues(b.path, b.from, b.to, smooth(Math.min(1, u)));
|
|
716
|
+
applyValue(ctx, b.state, b.path, v, b.node);
|
|
717
|
+
if (u >= 1)
|
|
718
|
+
this.blendOuts.delete(key);
|
|
719
|
+
}
|
|
609
720
|
const failed = [];
|
|
610
721
|
for (const [key, p] of winners) {
|
|
611
722
|
if (p.discrete)
|
|
612
723
|
continue;
|
|
613
|
-
|
|
614
|
-
|
|
724
|
+
// A driver taking the property over: start it from where the property is, not from the key.
|
|
725
|
+
let blend = this.blends.get(key);
|
|
726
|
+
if (!this.written.has(key)) {
|
|
727
|
+
const duration = p.blend ?? DEFAULT_BLEND;
|
|
728
|
+
const from = this.currentValue(p.state, p.path, p.node);
|
|
729
|
+
if (duration > 0 && from !== undefined && JSON.stringify(from) !== JSON.stringify(p.value)) {
|
|
730
|
+
blend = { from, start: this.clock, duration };
|
|
731
|
+
this.blends.set(key, blend);
|
|
732
|
+
this.dlog('blend in', key, { from, to: p.value, duration });
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
this.blends.delete(key);
|
|
736
|
+
blend = undefined;
|
|
737
|
+
if (this.debug)
|
|
738
|
+
this.dlogEvery('noblend:' + key, 2000, 'no blend', key, { duration, from, to: p.value });
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
let value = p.value;
|
|
742
|
+
if (blend) {
|
|
743
|
+
const u = (this.clock - blend.start) / blend.duration;
|
|
744
|
+
if (u >= 1)
|
|
745
|
+
this.blends.delete(key);
|
|
746
|
+
else
|
|
747
|
+
value = mixValues(p.path, blend.from, p.value, smooth(u));
|
|
748
|
+
}
|
|
749
|
+
const json = JSON.stringify(value);
|
|
750
|
+
if (!this.forceWrite && this.written.get(key) === json && !this.rewrite.has(p.state))
|
|
615
751
|
continue;
|
|
616
752
|
// Recorded only when it landed: a target that is not mounted yet (a model still
|
|
617
753
|
// loading) is retried next frame instead of being skipped for good.
|
|
618
|
-
if (
|
|
754
|
+
if (this.debug) {
|
|
755
|
+
this.probeJump(key, this.written.get(key), value, dt);
|
|
756
|
+
this.lastWritten.push(key + '=' + json.slice(0, 24));
|
|
757
|
+
if (!this.everWritten.has(key)) {
|
|
758
|
+
this.everWritten.add(key);
|
|
759
|
+
this.lastFirstWrites.push(key);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (applyValue(ctx, p.state, p.path, value, p.node)) {
|
|
619
763
|
this.written.set(key, json);
|
|
764
|
+
this.blendOf.set(key, p.blend ?? DEFAULT_BLEND);
|
|
765
|
+
}
|
|
620
766
|
else if (this.debug)
|
|
621
767
|
failed.push(key);
|
|
622
768
|
}
|
|
@@ -628,6 +774,9 @@ class ClipsRuntime {
|
|
|
628
774
|
else
|
|
629
775
|
this.rewrite.set(state, n - 1);
|
|
630
776
|
}
|
|
777
|
+
this.forceWrite = false;
|
|
778
|
+
if (this.debug)
|
|
779
|
+
this.tickCost = performance.now() - tickStart;
|
|
631
780
|
if (anyPlaying)
|
|
632
781
|
this.bump();
|
|
633
782
|
}
|
|
@@ -781,7 +930,7 @@ class ClipsRuntime {
|
|
|
781
930
|
*proposals() {
|
|
782
931
|
const drivers = [];
|
|
783
932
|
for (const inst of this.clips.values()) {
|
|
784
|
-
drivers.push({ order: inst.order, run: () => sampleTracks(inst.clip.tracks, inst.time) });
|
|
933
|
+
drivers.push({ order: inst.order, run: () => sampleTracks(inst.clip.tracks, inst.time, inst.clip.blend ?? DEFAULT_BLEND) });
|
|
785
934
|
}
|
|
786
935
|
for (const inst of this.sequences.values()) {
|
|
787
936
|
drivers.push({
|
|
@@ -790,7 +939,7 @@ class ClipsRuntime {
|
|
|
790
939
|
for (const e of inst.schedule.entries) {
|
|
791
940
|
if (!inst.active.has(e.id))
|
|
792
941
|
continue;
|
|
793
|
-
yield* sampleTracks(e.clip.tracks, entryLocalTime(e, inst.time));
|
|
942
|
+
yield* sampleTracks(e.clip.tracks, entryLocalTime(e, inst.time), e.clip.blend ?? inst.seq.blend ?? DEFAULT_BLEND);
|
|
794
943
|
}
|
|
795
944
|
},
|
|
796
945
|
});
|
|
@@ -804,13 +953,15 @@ class ClipsRuntime {
|
|
|
804
953
|
this.pendingRestore = [];
|
|
805
954
|
const done = new Set();
|
|
806
955
|
for (const track of tracks) {
|
|
807
|
-
if (track
|
|
956
|
+
if (isSwitchTrack(track))
|
|
808
957
|
continue; // the layer drops it on its own
|
|
809
958
|
const key = targetKey(track.state, track.node, track.path);
|
|
810
959
|
if (done.has(key))
|
|
811
960
|
continue;
|
|
812
961
|
done.add(key);
|
|
962
|
+
const last = this.written.get(key);
|
|
813
963
|
this.written.delete(key);
|
|
964
|
+
this.blends.delete(key);
|
|
814
965
|
if (track.node) {
|
|
815
966
|
// Node tracks restore their exact pre-animation snapshot (see nodeTracks).
|
|
816
967
|
const node = track.node;
|
|
@@ -821,10 +972,28 @@ class ClipsRuntime {
|
|
|
821
972
|
// (another driver re-writes it this frame).
|
|
822
973
|
if (releaseLive(track.state, track.path))
|
|
823
974
|
continue;
|
|
824
|
-
// Another driver may still own this property; it re-writes this frame.
|
|
975
|
+
// Another driver may still own this property; it re-writes this frame. Otherwise it glides
|
|
976
|
+
// back to the authored value (blend-out) instead of cutting.
|
|
825
977
|
const authored = getAtPath(ctx.getSettings(track.state), track.path);
|
|
826
|
-
if (authored
|
|
978
|
+
if (authored === undefined)
|
|
979
|
+
continue;
|
|
980
|
+
const duration = this.blendOf.get(key) ?? DEFAULT_BLEND;
|
|
981
|
+
let from;
|
|
982
|
+
if (last !== undefined) {
|
|
983
|
+
try {
|
|
984
|
+
from = JSON.parse(last);
|
|
985
|
+
}
|
|
986
|
+
catch {
|
|
987
|
+
from = undefined;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
if (duration > 0 && from !== undefined && canBlend(from) && canBlend(authored) && JSON.stringify(from) !== JSON.stringify(authored)) {
|
|
991
|
+
this.blendOuts.set(key, { state: track.state, path: track.path, from, to: authored, start: this.clock, duration });
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
this.blendOuts.delete(key);
|
|
827
995
|
applyValue(ctx, track.state, track.path, authored);
|
|
996
|
+
}
|
|
828
997
|
}
|
|
829
998
|
}
|
|
830
999
|
/** Whether any active driver still has a track on (state, node, path). */
|
|
@@ -842,7 +1011,8 @@ class ClipsRuntime {
|
|
|
842
1011
|
}
|
|
843
1012
|
advanceClip(inst, delta) {
|
|
844
1013
|
const { clip } = inst;
|
|
845
|
-
|
|
1014
|
+
// the play's own speed × the clip's saved rate
|
|
1015
|
+
inst.time += delta * inst.speed * rate(clip.speed) * inst.direction;
|
|
846
1016
|
const atEnd = inst.direction === 1 ? inst.time >= clip.duration : inst.time <= 0;
|
|
847
1017
|
if (!atEnd)
|
|
848
1018
|
return;
|
|
@@ -895,7 +1065,8 @@ class ClipsRuntime {
|
|
|
895
1065
|
inst.time = 0;
|
|
896
1066
|
return this.finishSequence(inst);
|
|
897
1067
|
}
|
|
898
|
-
|
|
1068
|
+
// the play's own speed × the sequence's saved rate
|
|
1069
|
+
inst.time += delta * inst.speed * rate(seq.speed) * inst.direction;
|
|
899
1070
|
const atEnd = inst.direction === 1 ? inst.time >= total : inst.time <= 0;
|
|
900
1071
|
if (!atEnd)
|
|
901
1072
|
return;
|
|
@@ -963,14 +1134,14 @@ class ClipsRuntime {
|
|
|
963
1134
|
}
|
|
964
1135
|
const round2 = (n) => Math.round(n * 100) / 100;
|
|
965
1136
|
const isDriven = (seq) => !!seq.driver && seq.driver !== 'time';
|
|
966
|
-
function* sampleTracks(tracks, t) {
|
|
1137
|
+
function* sampleTracks(tracks, t, blend) {
|
|
967
1138
|
for (const track of tracks) {
|
|
968
1139
|
if (track.muted || track.keys.length === 0)
|
|
969
1140
|
continue;
|
|
970
1141
|
const value = sampleTrack(track, t);
|
|
971
1142
|
if (value === undefined)
|
|
972
1143
|
continue;
|
|
973
|
-
yield { state: track.state, node: track.node, path: track.path, value, discrete:
|
|
1144
|
+
yield { state: track.state, node: track.node, path: track.path, value, discrete: isSwitchTrack(track), blend };
|
|
974
1145
|
}
|
|
975
1146
|
}
|
|
976
1147
|
const clipsRuntime = new ClipsRuntime();
|
|
@@ -8,6 +8,15 @@ export declare const snapToFrame: (t: number, fps: number) => number;
|
|
|
8
8
|
/** 'SS:FF' timecode (minutes folded into seconds past 59 — clips are short). */
|
|
9
9
|
export declare function timecode(t: number, fps: number): string;
|
|
10
10
|
export declare function easeProgress(ease: EaseName | undefined, p: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* A switch track: set at its keys through the SceneActions patch layer (the element
|
|
13
|
+
* re-renders, as when an action changes it), never written per frame. The structural
|
|
14
|
+
* tracks (Track.discrete) — and an object's `meshSettings.visible`: showing / hiding has
|
|
15
|
+
* to reach the object's settings, where its visibility-linked effects play in and out
|
|
16
|
+
* (usePresentedVisibility). Written straight onto the Object3D it would cut them.
|
|
17
|
+
* A model part's `visible` (node track) stays per frame — parts have no effects.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isSwitchTrack: (track: Pick<Track, "discrete" | "node" | "path">) => boolean;
|
|
11
20
|
/**
|
|
12
21
|
* The track's value at time t. Before the first key: the first key's value;
|
|
13
22
|
* after the last: the last key's value. Keys must be sorted by t.
|
|
@@ -18,6 +27,12 @@ export declare const sortKeys: (keys: Keyframe[]) => Keyframe[];
|
|
|
18
27
|
export declare function upsertKey(track: Track, t: number, value: KeyValue, fps: number): Track;
|
|
19
28
|
/** Move keys by dt seconds, clamped to [0, duration], snapped to frames unless `free`. */
|
|
20
29
|
export declare function moveKeys(clip: AnimationClip, selection: Set<string>, dt: number, free: boolean): AnimationClip;
|
|
30
|
+
/**
|
|
31
|
+
* Copies of the selected keys `dt` seconds away (snapped to a frame), on their own tracks; the
|
|
32
|
+
* originals stay. A copy landing on a key of its track replaces it. `ids` maps original → copy id
|
|
33
|
+
* (pass the same map while dragging so the copies keep their ids).
|
|
34
|
+
*/
|
|
35
|
+
export declare function copyKeys(clip: AnimationClip, selection: Set<string>, dt: number, ids: Map<string, string>): AnimationClip;
|
|
21
36
|
export declare function deleteKeys(clip: AnimationClip, selection: Set<string>): AnimationClip;
|
|
22
37
|
export declare function setKeysEase(clip: AnimationClip, selection: Set<string>, ease: EaseName): AnimationClip;
|
|
23
38
|
export declare function setKeyValue(clip: AnimationClip, keyId: string, value: KeyValue): AnimationClip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipUtils.d.ts","sourceRoot":"","sources":["../../src/animationsV2/clipUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAOlF,eAAO,MAAM,GAAG,GAAI,QAAQ,MAAM,WAAqF,CAAC;AAExH,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAOrD;AAMD,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,KAAK,MAAM,WAAwB,CAAC;AAC9E,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,WAAgB,CAAC;AAC1E,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,EAAE,KAAK,MAAM,WAAgD,CAAC;AAEnG,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKvD;AAaD,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAG,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|
return p;
|
|
47
47
|
return applyEasing(name, p);
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* A switch track: set at its keys through the SceneActions patch layer (the element
|
|
51
|
+
* re-renders, as when an action changes it), never written per frame. The structural
|
|
52
|
+
* tracks (Track.discrete) — and an object's `meshSettings.visible`: showing / hiding has
|
|
53
|
+
* to reach the object's settings, where its visibility-linked effects play in and out
|
|
54
|
+
* (usePresentedVisibility). Written straight onto the Object3D it would cut them.
|
|
55
|
+
* A model part's `visible` (node track) stays per frame — parts have no effects.
|
|
56
|
+
*/
|
|
57
|
+
export const isSwitchTrack = (track) => !!track.discrete || (!track.node && track.path === 'meshSettings.visible');
|
|
49
58
|
/**
|
|
50
59
|
* The track's value at time t. Before the first key: the first key's value;
|
|
51
60
|
* after the last: the last key's value. Keys must be sorted by t.
|
|
@@ -56,7 +65,7 @@ export function sampleTrack(track, t) {
|
|
|
56
65
|
return undefined;
|
|
57
66
|
// A switch track switches AT its first key: before it the element keeps its authored value
|
|
58
67
|
// (an eased track holds its first value before it, so a move can start later than 0).
|
|
59
|
-
if (t < keys[0].t - 1e-9 && track
|
|
68
|
+
if (t < keys[0].t - 1e-9 && isSwitchTrack(track))
|
|
60
69
|
return undefined;
|
|
61
70
|
if (t <= keys[0].t)
|
|
62
71
|
return keys[0].value;
|
|
@@ -75,7 +84,7 @@ export function sampleTrack(track, t) {
|
|
|
75
84
|
}
|
|
76
85
|
const a = keys[lo];
|
|
77
86
|
const b = keys[hi];
|
|
78
|
-
if (track
|
|
87
|
+
if (isSwitchTrack(track) || isSteppedValue(a.value) || isSteppedValue(b.value))
|
|
79
88
|
return a.value;
|
|
80
89
|
const span = b.t - a.t;
|
|
81
90
|
const p = span > 0 ? easeProgress(a.ease, (t - a.t) / span) : 1;
|
|
@@ -115,6 +124,34 @@ export function moveKeys(clip, selection, dt, free) {
|
|
|
115
124
|
}),
|
|
116
125
|
};
|
|
117
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Copies of the selected keys `dt` seconds away (snapped to a frame), on their own tracks; the
|
|
129
|
+
* originals stay. A copy landing on a key of its track replaces it. `ids` maps original → copy id
|
|
130
|
+
* (pass the same map while dragging so the copies keep their ids).
|
|
131
|
+
*/
|
|
132
|
+
export function copyKeys(clip, selection, dt, ids) {
|
|
133
|
+
return {
|
|
134
|
+
...clip,
|
|
135
|
+
tracks: clip.tracks.map(track => {
|
|
136
|
+
const picked = track.keys.filter(k => selection.has(k.id));
|
|
137
|
+
if (!picked.length)
|
|
138
|
+
return track;
|
|
139
|
+
const copies = picked.map(k => {
|
|
140
|
+
let id = ids.get(k.id);
|
|
141
|
+
if (!id) {
|
|
142
|
+
id = uid('k');
|
|
143
|
+
ids.set(k.id, id);
|
|
144
|
+
}
|
|
145
|
+
return { ...k, id, t: snapToFrame(Math.min(clip.duration, Math.max(0, k.t + dt)), clip.fps) };
|
|
146
|
+
});
|
|
147
|
+
const taken = new Set(copies.map(c => c.t));
|
|
148
|
+
// a copy on top of its own original replaces nothing (no move yet): keep the original
|
|
149
|
+
const kept = track.keys.filter(k => selection.has(k.id) || !taken.has(k.t));
|
|
150
|
+
const fresh = copies.filter(c => !picked.some(p => p.t === c.t));
|
|
151
|
+
return { ...track, keys: sortKeys([...kept, ...fresh]) };
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
118
155
|
export function deleteKeys(clip, selection) {
|
|
119
156
|
return {
|
|
120
157
|
...clip,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/animationsV2/normalize.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAC;AAQhF,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/animationsV2/normalize.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAC;AAQhF,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAkBrD;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,iBAAiB,CA8C7D"}
|
|
@@ -13,6 +13,8 @@ export function normalizeClip(row) {
|
|
|
13
13
|
loop: flag(row.loop),
|
|
14
14
|
yoyo: flag(row.yoyo),
|
|
15
15
|
endMode: row.endMode === 'restore' ? 'restore' : 'hold',
|
|
16
|
+
speed: Number(row.speed) > 0 ? Number(row.speed) : 1,
|
|
17
|
+
...(row.blend !== undefined && row.blend !== null && Number.isFinite(Number(row.blend)) ? { blend: Math.max(0, Number(row.blend)) } : {}),
|
|
16
18
|
tracks: Array.isArray(row.tracks) ? row.tracks : [],
|
|
17
19
|
cues: (Array.isArray(row.cues) ? row.cues : [])
|
|
18
20
|
.filter((c) => c && c.command && typeof c.command === 'object')
|
|
@@ -56,6 +58,8 @@ export function normalizeSequence(row) {
|
|
|
56
58
|
yoyo: flag(row.yoyo),
|
|
57
59
|
reverse: flag(row.reverse),
|
|
58
60
|
endMode: row.endMode === 'restore' ? 'restore' : 'hold',
|
|
61
|
+
speed: Number(row.speed) > 0 ? Number(row.speed) : 1,
|
|
62
|
+
...(row.blend !== undefined && row.blend !== null && Number.isFinite(Number(row.blend)) ? { blend: Math.max(0, Number(row.blend)) } : {}),
|
|
59
63
|
driver: DRIVERS.includes(row.driver) ? row.driver : 'time',
|
|
60
64
|
driverSettings: {
|
|
61
65
|
sensitivity: Number(row.driverSettings?.sensitivity) > 0 ? Number(row.driverSettings.sensitivity) : DEFAULT_DRIVER_SETTINGS.sensitivity,
|
|
@@ -47,6 +47,14 @@ export interface AnimationClip {
|
|
|
47
47
|
yoyo: boolean;
|
|
48
48
|
/** When a non-looping clip finishes: keep the last values, or return to authored. */
|
|
49
49
|
endMode: 'hold' | 'restore';
|
|
50
|
+
/** Playback rate when the clip plays directly (1 = authored; a play's own speed multiplies it). Inside a sequence, the step clip's speed applies. */
|
|
51
|
+
speed?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Seconds a property glides from where it is to the clip's value when the clip takes it over,
|
|
54
|
+
* and back to the authored value when the clip lets it go (see ClipsRuntime blends). Absent: the
|
|
55
|
+
* runtime default (DEFAULT_BLEND). 0 = snap, as before.
|
|
56
|
+
*/
|
|
57
|
+
blend?: number;
|
|
50
58
|
tracks: Track[];
|
|
51
59
|
/** Effects, effect clips and actions switched / fired along the clip (TimelineCue). */
|
|
52
60
|
cues?: TimelineCue[];
|
|
@@ -124,6 +132,10 @@ export interface AnimationSequence {
|
|
|
124
132
|
yoyo: boolean;
|
|
125
133
|
reverse: boolean;
|
|
126
134
|
endMode: 'hold' | 'restore';
|
|
135
|
+
/** Playback rate of the whole sequence (1 = authored; a play's own speed multiplies it). Input-driven sequences ignore it. */
|
|
136
|
+
speed?: number;
|
|
137
|
+
/** Blend-in / out seconds for every clip in the sequence (a clip's own `blend` wins). Absent: the runtime default. */
|
|
138
|
+
blend?: number;
|
|
127
139
|
/** What moves the clock. Input drivers scrub the sequence instead of playing it. */
|
|
128
140
|
driver: SequenceDriver;
|
|
129
141
|
driverSettings: SequenceDriverSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/animationsV2/types.ts"],"names":[],"mappings":"AAMA,wFAAwF;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAChB,QAAQ,GAAG,MAAM,GACjB,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,aAAa,GAAG,cAAc,GAAG,gBAAgB,GACjD,aAAa,GAAG,cAAc,GAAG,gBAAgB,GACjD,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,YAAY,GAAG,aAAa,GAAG,eAAe,GAC9C,YAAY,GAAG,aAAa,GAAG,eAAe,GA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