illutions 0.24.1 → 0.25.0
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/CHANGELOG.md +12 -0
- package/dist/main.d.ts +56 -60
- package/dist/main.min.cjs +1 -1
- package/dist/main.min.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added `CanvasPointerLeave` handling to the `OBJ3D_POINTER_LEAVE` event.
|
|
8
|
+
- Added `ActionCtrls` for centralized animation action lifecycle, layer grouping, and interruptible fades.
|
|
9
|
+
- Extended `ClipEvent` with `CLIP_CANCEL`, `CLIP_FADE_START`, `CLIP_FADE_COMPLETE`, `CLIP_SPEED_START`, and `CLIP_SPEED_COMPLETE` events.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed `OBJ3D_POINTER_LEAVE` being emitted during pointer movement with a pressed mouse button and ensured touch pointers emit it after `OBJ3D_POINTER_UP` when contact ends.
|
|
14
|
+
|
|
3
15
|
## 0.24.1
|
|
4
16
|
|
|
5
17
|
### Added
|
package/dist/main.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export declare interface AaCfg {
|
|
|
48
48
|
mode: 'none' | 'fxaa' | 'smaa';
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
export declare type ActionFadeMode = 'in' | 'out';
|
|
52
|
+
|
|
51
53
|
/**
|
|
52
54
|
* Defines the ambient light settings controlling global scene illumination.
|
|
53
55
|
* @category Cfg
|
|
@@ -296,8 +298,8 @@ export declare interface AudioLoadedEvent {
|
|
|
296
298
|
|
|
297
299
|
/**
|
|
298
300
|
* Defines how an animation action is blended with other active actions.
|
|
299
|
-
* -
|
|
300
|
-
* -
|
|
301
|
+
* - 'normal': Blends the action's values with other normal actions according to their weights.
|
|
302
|
+
* - 'additive': Adds the action's values to the current animation result according to its weight.
|
|
301
303
|
*/
|
|
302
304
|
export declare type BlendMode = 'normal' | 'additive';
|
|
303
305
|
|
|
@@ -502,28 +504,18 @@ export declare type Classes<TObj3DClasses extends Record<string, Obj3DClass> = {
|
|
|
502
504
|
comps?: TCompClasses;
|
|
503
505
|
};
|
|
504
506
|
|
|
505
|
-
/** @event Fired when a clip starts
|
|
507
|
+
/** @event Fired when a clip starts, completes, is canceled, fades its weight, or changes its playback speed. */
|
|
506
508
|
export declare interface ClipEvent {
|
|
507
509
|
/** Identifies this event type. */
|
|
508
|
-
type: 'CLIP_START' | 'CLIP_COMPLETE';
|
|
509
|
-
/** The name of the `THREE.AnimationClip
|
|
510
|
-
clipName: string;
|
|
511
|
-
/** The name of the calling method. */
|
|
512
|
-
fct: string;
|
|
513
|
-
/** The associated animation action, when available. */
|
|
514
|
-
action?: THREE_TYPE.AnimationAction;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
/** @event Fired when a clip fade starts, completes, or fade-out starts/completes and triggers the corresponding XState event. */
|
|
518
|
-
export declare interface ClipFadeEvent {
|
|
519
|
-
/** Identifies this event type. */
|
|
520
|
-
type: 'CLIP_FADE_START' | 'CLIP_FADE_COMPLETE' | 'CLIP_FADEOUT_COMPLETE' | 'CLIP_FADEOUT_START';
|
|
521
|
-
/** The name of the `THREE.AnimationClip` whose fade changed state. */
|
|
510
|
+
type: 'CLIP_START' | 'CLIP_COMPLETE' | 'CLIP_CANCEL' | 'CLIP_FADE_START' | 'CLIP_FADE_COMPLETE' | 'CLIP_SPEED_START' | 'CLIP_SPEED_COMPLETE';
|
|
511
|
+
/** The name of the affected `THREE.AnimationClip`. */
|
|
522
512
|
clipName: string;
|
|
523
513
|
/** The name of the calling method. */
|
|
524
514
|
fct: string;
|
|
525
515
|
/** The associated animation action, when available. */
|
|
526
516
|
action?: THREE_TYPE.AnimationAction;
|
|
517
|
+
/** Whether the clip weight is fading in or out. */
|
|
518
|
+
fadeMode?: ActionFadeMode;
|
|
527
519
|
}
|
|
528
520
|
|
|
529
521
|
declare type ColorNode = THREE_WEBGPU_TYPE.Node<'vec4'>;
|
|
@@ -610,12 +602,10 @@ export declare class Engine {
|
|
|
610
602
|
private readonly cam3D;
|
|
611
603
|
private readonly events;
|
|
612
604
|
private readonly modules;
|
|
613
|
-
private readonly comps;
|
|
614
605
|
private readonly objs3D;
|
|
615
606
|
private readonly cfg;
|
|
616
607
|
private readonly infoBox;
|
|
617
|
-
private
|
|
618
|
-
private readonly objActions;
|
|
608
|
+
private actionCtrls;
|
|
619
609
|
private gltf;
|
|
620
610
|
private mixer;
|
|
621
611
|
private callbacks;
|
|
@@ -652,7 +642,6 @@ export declare class Engine {
|
|
|
652
642
|
/* Excluded from this release type: __constructor */
|
|
653
643
|
/* Excluded from this release type: init */
|
|
654
644
|
private initWebGpuRenderer;
|
|
655
|
-
private addActionToObj;
|
|
656
645
|
/**
|
|
657
646
|
* Registers a callback that is executed on every requestAnimationFrame update.
|
|
658
647
|
* @param {(deltaTime: number) => void} cb - Callback executed once per frame with `deltaTime`.
|
|
@@ -756,8 +745,6 @@ export declare class Engine {
|
|
|
756
745
|
[key: string]: any;
|
|
757
746
|
}): void;
|
|
758
747
|
private calcEaseArea;
|
|
759
|
-
private stopObjActions;
|
|
760
|
-
private finishAction;
|
|
761
748
|
/**
|
|
762
749
|
* Selects the active anti-aliasing mode. The modes `'fxaa'` and `'smaa'` lazy-load their required modules.
|
|
763
750
|
* @param aaMode - The anti-aliasing mode to use.
|
|
@@ -781,35 +768,37 @@ export declare class Engine {
|
|
|
781
768
|
* Finds a Three.js animation clip by name and plays it through the `THREE.AnimationMixer`.
|
|
782
769
|
*
|
|
783
770
|
* @param params - Parameters for controlling the animation playback.
|
|
784
|
-
* @param params.
|
|
771
|
+
* @param params.layer - The freely named layer used to group animation actions.
|
|
785
772
|
* @param params.clip - The name of the animation clip to play.
|
|
786
773
|
* @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
|
|
787
774
|
* @param params.finishMode - Whether the final pose is held or faded out after the final loop. Default: **'hold'**
|
|
788
|
-
* @param params.
|
|
789
|
-
* @param params.stopMode - Which previous actions of the same
|
|
775
|
+
* @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
776
|
+
* @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
790
777
|
* @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
791
778
|
* @param params.fadeDurationFinish - Duration in seconds for `finishMode: 'fadeOut'`. Default: **0**
|
|
792
779
|
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
793
|
-
* @param params.reset - If `true`, resets the clip before playback. Default: **false**
|
|
780
|
+
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
794
781
|
* @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
|
|
795
782
|
* @param params.endSpeed - Target playback speed. Default: **1**
|
|
796
783
|
* @param params.duration - Duration in seconds for speed interpolation. Default: **0**
|
|
797
784
|
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
798
785
|
*
|
|
799
786
|
* @remarks
|
|
800
|
-
*
|
|
787
|
+
* Calling a running or fading-in action again is ignored. A finished or stopped action starts again, while an unfinished fading-out action continues at its current time and fades back in from its current weight.
|
|
788
|
+
*
|
|
789
|
+
* `finishMode` and `fadeDurationFinish` have no effect when `loopMode` is `'infinite'`.
|
|
801
790
|
*
|
|
802
791
|
* **Events**
|
|
803
792
|
*
|
|
804
793
|
* {@link ClipEvent}
|
|
805
794
|
*/
|
|
806
|
-
playClip({
|
|
807
|
-
|
|
795
|
+
playClip({ layer, clip: clipName, blendMode, finishMode, loopMode, stopMode, fadeDuration, fadeDurationFinish, reverse, reset, startSpeed, endSpeed, duration, ease }: {
|
|
796
|
+
layer: string;
|
|
808
797
|
clip: string;
|
|
809
798
|
singleAction?: boolean;
|
|
810
799
|
blendMode?: BlendMode;
|
|
811
800
|
finishMode?: FinishMode;
|
|
812
|
-
|
|
801
|
+
loopMode?: LoopMode;
|
|
813
802
|
stopMode?: StopMode;
|
|
814
803
|
fadeDuration?: number;
|
|
815
804
|
fadeDurationFinish?: number;
|
|
@@ -824,30 +813,31 @@ export declare class Engine {
|
|
|
824
813
|
* Finds a camera animation clip by name and plays it through the `THREE.AnimationMixer`.
|
|
825
814
|
*
|
|
826
815
|
* @param params - Parameters for controlling the camera animation playback.
|
|
827
|
-
* @param params.
|
|
816
|
+
* @param params.layer - The freely named layer used to group camera animation actions.
|
|
828
817
|
* @param params.clip - The name of the camera animation clip to play.
|
|
829
818
|
* @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
|
|
830
|
-
* @param params.
|
|
831
|
-
* @param params.stopMode - Which previous actions of the same
|
|
819
|
+
* @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
820
|
+
* @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
832
821
|
* @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
833
|
-
|
|
834
822
|
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
835
|
-
* @param params.reset - If `true`, resets the clip before playback. Default: **false**
|
|
823
|
+
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
836
824
|
* @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
|
|
837
825
|
* @param params.endSpeed - Target playback speed. Default: **1**
|
|
838
826
|
* @param params.duration - Duration in seconds for speed interpolation. Default: **0**
|
|
839
827
|
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
840
828
|
*
|
|
841
|
-
|
|
829
|
+
* @remarks
|
|
830
|
+
* Calling a running or fading-in action again is ignored. A finished or stopped action starts again, while an unfinished fading-out action continues at its current time and fades back in from its current weight.
|
|
831
|
+
*
|
|
842
832
|
* **Events**
|
|
843
833
|
*
|
|
844
834
|
* {@link ClipEvent}
|
|
845
835
|
*/
|
|
846
|
-
playClipCam({
|
|
847
|
-
|
|
836
|
+
playClipCam({ layer, clip: clipName, blendMode, loopMode, stopMode, fadeDuration, reverse, reset, startSpeed, endSpeed, duration, ease }: {
|
|
837
|
+
layer: string;
|
|
848
838
|
clip: string;
|
|
849
839
|
blendMode?: BlendMode;
|
|
850
|
-
|
|
840
|
+
loopMode?: LoopMode;
|
|
851
841
|
stopMode?: StopMode;
|
|
852
842
|
fadeDuration?: number;
|
|
853
843
|
reverse?: boolean;
|
|
@@ -946,12 +936,12 @@ export declare class Engine {
|
|
|
946
936
|
* @param params.ease - The easing function name for the fade-out transition. Default: **'power1.inOut'**
|
|
947
937
|
*
|
|
948
938
|
* @remarks
|
|
949
|
-
* The method gradually reduces the clip's playback speed to zero when `fadeOut` is greater than zero
|
|
950
|
-
*
|
|
939
|
+
* The method gradually reduces the clip's playback speed to zero when `fadeOut` is greater than zero. It emits `CLIP_SPEED_START`, `CLIP_SPEED_COMPLETE`, and finally `CLIP_CANCEL`.
|
|
940
|
+
* If no speed transition is specified, the clip is canceled immediately.
|
|
951
941
|
*
|
|
952
942
|
* **Events**
|
|
953
943
|
*
|
|
954
|
-
* {@link
|
|
944
|
+
* {@link ClipEvent}
|
|
955
945
|
*/
|
|
956
946
|
stopAnimClip({ clipName, fadeOut, ease }: {
|
|
957
947
|
clipName: string;
|
|
@@ -1122,7 +1112,6 @@ export declare class Events {
|
|
|
1122
1112
|
/* Excluded from this release type: animFade */
|
|
1123
1113
|
/* Excluded from this release type: audioLoaded */
|
|
1124
1114
|
/* Excluded from this release type: clip */
|
|
1125
|
-
/* Excluded from this release type: clipFade */
|
|
1126
1115
|
/* Excluded from this release type: modelError */
|
|
1127
1116
|
/* Excluded from this release type: modelLoading */
|
|
1128
1117
|
/**
|
|
@@ -1136,8 +1125,8 @@ export declare class Events {
|
|
|
1136
1125
|
|
|
1137
1126
|
/**
|
|
1138
1127
|
* Defines how an animation action behaves after its final loop.
|
|
1139
|
-
* -
|
|
1140
|
-
* -
|
|
1128
|
+
* - 'hold': Keeps the action enabled and holds its final pose.
|
|
1129
|
+
* - 'fadeOut': Fades the action out using fadeDurationFinish, or disables it immediately when the duration is 0.
|
|
1141
1130
|
*/
|
|
1142
1131
|
export declare type FinishMode = 'hold' | 'fadeOut';
|
|
1143
1132
|
|
|
@@ -1507,8 +1496,8 @@ export declare interface LightCfg {
|
|
|
1507
1496
|
|
|
1508
1497
|
/**
|
|
1509
1498
|
* Defines how often an animation action is played.
|
|
1510
|
-
* -
|
|
1511
|
-
* -
|
|
1499
|
+
* - number: Plays the action the specified positive number of times.
|
|
1500
|
+
* - 'infinite': Repeats the action indefinitely.
|
|
1512
1501
|
*/
|
|
1513
1502
|
export declare type LoopMode = number | 'infinite';
|
|
1514
1503
|
|
|
@@ -2065,12 +2054,14 @@ export declare class Raycast {
|
|
|
2065
2054
|
private objCandidate;
|
|
2066
2055
|
private closestObjCounter;
|
|
2067
2056
|
private isEnabled;
|
|
2068
|
-
private
|
|
2057
|
+
private callback;
|
|
2069
2058
|
private listenerClick;
|
|
2059
|
+
private listenerCancel;
|
|
2070
2060
|
private listenerDown;
|
|
2061
|
+
private listenerLeave;
|
|
2071
2062
|
private listenerMove;
|
|
2072
2063
|
private listenerUp;
|
|
2073
|
-
private
|
|
2064
|
+
private eventPointerMove;
|
|
2074
2065
|
private posPrevPointerX;
|
|
2075
2066
|
private posPrevPointerY;
|
|
2076
2067
|
private posWorldObj;
|
|
@@ -2081,6 +2072,7 @@ export declare class Raycast {
|
|
|
2081
2072
|
enable(): void;
|
|
2082
2073
|
/** Disables pointer-based raycasting and removes all pointer event listeners and the frame update callback. */
|
|
2083
2074
|
disable(): void;
|
|
2075
|
+
private getObjectAtPointer;
|
|
2084
2076
|
/**
|
|
2085
2077
|
* Checks whether an object's world position is visible from the active camera without being occluded.
|
|
2086
2078
|
*
|
|
@@ -2088,15 +2080,19 @@ export declare class Raycast {
|
|
|
2088
2080
|
* @returns `true` if no other object blocks the line of sight to the object's world position, otherwise `false`.
|
|
2089
2081
|
*/
|
|
2090
2082
|
isVisibleOcclusion(obj: THREE_TYPE.Object3D): boolean;
|
|
2091
|
-
private
|
|
2092
|
-
private
|
|
2083
|
+
private onCanvasClick;
|
|
2084
|
+
private onCanvasPointerLeave;
|
|
2085
|
+
private onCanvasPointerMove;
|
|
2086
|
+
private onCanvasPointerCancel;
|
|
2087
|
+
private onCanvasPointerDown;
|
|
2088
|
+
private onCanvasPointerExit;
|
|
2089
|
+
private onCanvasPointerUp;
|
|
2093
2090
|
private onPointerEnter;
|
|
2094
2091
|
private onPointerLeave;
|
|
2095
2092
|
private onPointerMove;
|
|
2096
|
-
private onPointerUp;
|
|
2097
2093
|
/**
|
|
2098
2094
|
* Begins tracking a list of scene objects for pointer intersection detection. If the raycaster is not yet listening for pointer movements, this method automatically attaches pointer event listeners
|
|
2099
|
-
* (`pointermove`, `click`, `pointerdown`, `pointerup`).
|
|
2095
|
+
* (`pointermove`, `click`, `pointercancel`, `pointerdown`, `pointerleave`, `pointerup`).
|
|
2100
2096
|
*
|
|
2101
2097
|
* @param params - Parameter object.
|
|
2102
2098
|
* @param params.objs3D - The `Obj3D` instances to track.
|
|
@@ -2119,8 +2115,8 @@ export declare class Raycast {
|
|
|
2119
2115
|
untrackSelectable({ objs3D }: {
|
|
2120
2116
|
objs3D: Obj3D[];
|
|
2121
2117
|
}): void;
|
|
2122
|
-
/* Excluded from this release type:
|
|
2123
|
-
private
|
|
2118
|
+
/* Excluded from this release type: updatePointerHover */
|
|
2119
|
+
private updatePointerPosition;
|
|
2124
2120
|
}
|
|
2125
2121
|
|
|
2126
2122
|
/**
|
|
@@ -2576,10 +2572,10 @@ export declare interface StateMachineCfg {
|
|
|
2576
2572
|
}
|
|
2577
2573
|
|
|
2578
2574
|
/**
|
|
2579
|
-
* Defines which previous active animation actions of the same
|
|
2580
|
-
* -
|
|
2581
|
-
* -
|
|
2582
|
-
* -
|
|
2575
|
+
* Defines which previous active animation actions of the same layer are stopped before a new action is played.
|
|
2576
|
+
* - 'all': Stops all previous active actions.
|
|
2577
|
+
* - 'last': Stops only the most recently played previous active action.
|
|
2578
|
+
* - 'none': Keeps all previous active actions running.
|
|
2583
2579
|
*/
|
|
2584
2580
|
export declare type StopMode = 'all' | 'last' | 'none';
|
|
2585
2581
|
|