@shopware-ag/dive 2.2.33 → 2.3.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/build/chunks/Animator-BGFdF70Z.mjs +47 -0
- package/build/chunks/Animator-Cu7NIkVg.cjs +1 -0
- package/build/chunks/{AssetCache-DITWKcA3.cjs → AssetCache-BZhTsybC.cjs} +1 -1
- package/build/chunks/{AssetCache-Bf5zeBf8.mjs → AssetCache-p0Zr71Yh.mjs} +1 -1
- package/build/chunks/{AssetExporter-brT7ogoM.mjs → AssetExporter-BBaDvZ8D.mjs} +68 -61
- package/build/chunks/{AssetExporter-DsbC2rqv.cjs → AssetExporter-Bqv27MWV.cjs} +15 -15
- package/build/chunks/{AssetLoader-C_jb3yoa.mjs → AssetLoader-Dcr75VNw.mjs} +20 -12
- package/build/chunks/{AssetLoader-Bzy-S1g6.cjs → AssetLoader-Drtmvqgs.cjs} +2 -2
- package/build/chunks/ClipAnimator-BL9qzfWl.mjs +83 -0
- package/build/chunks/ClipAnimator-BcDOC3qJ.cjs +1 -0
- package/build/chunks/{FileTypes-BZhCMKod.cjs → FileTypes-35x8Ekp6.cjs} +2 -2
- package/build/chunks/{FileTypes-G8UMidQm.mjs → FileTypes-BSG8CC2s.mjs} +41 -38
- package/build/chunks/TargetAnimator-DUqkkdVb.mjs +79 -0
- package/build/chunks/TargetAnimator-DuqPk2eq.cjs +1 -0
- package/build/chunks/{isFileTypeSupported-DmYBJKl4.cjs → isFileTypeSupported-BmjxgShb.cjs} +1 -1
- package/build/chunks/{isFileTypeSupported-Dm54ZeVd.mjs → isFileTypeSupported-DBPOEmTI.mjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- package/build/plugins/animation/index.cjs +1 -1
- package/build/plugins/animation/index.d.ts +1 -1
- package/build/plugins/animation/index.mjs +84 -109
- package/build/plugins/animation/src/animator/Animator.d.ts +23 -22
- package/build/plugins/animation/src/animator/ClipAnimator.d.ts +33 -0
- package/build/plugins/animation/src/animator/TargetAnimator.d.ts +45 -0
- package/build/plugins/animation/src/index.d.ts +4 -2
- package/build/plugins/animation/src/system/AnimationSystem.d.ts +136 -14
- package/build/plugins/animation/src/types/AnimatorTypes.d.ts +11 -0
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +2 -2
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetexporter/index.cjs +1 -1
- package/build/plugins/assetexporter/index.mjs +1 -1
- package/build/plugins/assetexporter/src/AssetExporter.d.ts +1 -0
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +2 -2
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +7 -7
- package/build/plugins/quickview/src/QuickView.d.ts +2 -1
- package/build/plugins/state/index.cjs +4 -4
- package/build/plugins/state/index.mjs +791 -794
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +1 -1
- package/package.json +2 -2
- package/build/plugins/animation/src/types/AnimatorParameters.d.ts +0 -7
|
@@ -1,126 +1,101 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
1
|
+
var e = Object.defineProperty;
|
|
2
|
+
var m = (i, t, a) => t in i ? e(i, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[t] = a;
|
|
3
|
+
var n = (i, t, a) => m(i, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { Easing as c } from "@tweenjs/tween.js";
|
|
5
|
+
import { Easing as w } from "@tweenjs/tween.js";
|
|
5
6
|
import { MathUtils as p } from "three";
|
|
6
|
-
class
|
|
7
|
-
|
|
8
|
-
this
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
hasEventListener(e, t) {
|
|
13
|
-
if (this._listeners === void 0) return !1;
|
|
14
|
-
const i = this._listeners;
|
|
15
|
-
return i[e] !== void 0 && i[e].indexOf(t) !== -1;
|
|
16
|
-
}
|
|
17
|
-
removeEventListener(e, t) {
|
|
18
|
-
if (this._listeners === void 0) return;
|
|
19
|
-
const n = this._listeners[e];
|
|
20
|
-
if (n !== void 0) {
|
|
21
|
-
const s = n.indexOf(t);
|
|
22
|
-
s !== -1 && n.splice(s, 1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
dispatchEvent(e) {
|
|
26
|
-
if (this._listeners === void 0) return;
|
|
27
|
-
const i = this._listeners[e.type];
|
|
28
|
-
if (i !== void 0) {
|
|
29
|
-
e.target = this;
|
|
30
|
-
const n = i.slice(0);
|
|
31
|
-
for (let s = 0, l = n.length; s < l; s++)
|
|
32
|
-
n[s].call(this, e);
|
|
33
|
-
e.target = null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
class _ extends u {
|
|
38
|
-
constructor(t, i, n, s) {
|
|
39
|
-
super();
|
|
40
|
-
r(this, "_uuid", p.generateUUID());
|
|
41
|
-
r(this, "_playing", !1);
|
|
42
|
-
r(this, "_stopped", !1);
|
|
43
|
-
r(this, "_completed", !1);
|
|
44
|
-
this.object = t, this.to = i, this.duration = n, this.options = s;
|
|
45
|
-
}
|
|
46
|
-
get uuid() {
|
|
47
|
-
return this._uuid;
|
|
48
|
-
}
|
|
49
|
-
get playing() {
|
|
50
|
-
return this._playing;
|
|
51
|
-
}
|
|
52
|
-
get stopped() {
|
|
53
|
-
return this._stopped;
|
|
54
|
-
}
|
|
55
|
-
get completed() {
|
|
56
|
-
return this._completed;
|
|
7
|
+
class l {
|
|
8
|
+
constructor() {
|
|
9
|
+
n(this, "uuid", p.generateUUID());
|
|
10
|
+
n(this, "Easing", c);
|
|
11
|
+
n(this, "_animators", /* @__PURE__ */ new Map());
|
|
57
12
|
}
|
|
58
13
|
dispose() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return this._playing = !0, this._stopped = !1, this.dispatchEvent({ type: "play", target: this }), this;
|
|
14
|
+
for (const t of this._animators.values())
|
|
15
|
+
t.dispose();
|
|
16
|
+
this._animators.clear();
|
|
63
17
|
}
|
|
64
|
-
|
|
65
|
-
|
|
18
|
+
tick(t) {
|
|
19
|
+
for (const a of this._animators.values())
|
|
20
|
+
a.update(t);
|
|
66
21
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `fromTargets()` instead.
|
|
24
|
+
* @note This method also calls .play() on the animator automatically. This has been removed in fromTargets(). You have to call .play() independently after creating the animator.
|
|
25
|
+
*/
|
|
26
|
+
async animate(t, a, s) {
|
|
27
|
+
const o = await this.fromTargets(t, a, s);
|
|
28
|
+
return o.play(), o;
|
|
74
29
|
}
|
|
75
30
|
/**
|
|
76
|
-
* Creates a
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
31
|
+
* Creates a TargetAnimator and returns it asynchronously.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Animate a single target (e.g. position).
|
|
35
|
+
* const animator = await animationSystem.fromTargets(
|
|
36
|
+
* { position: { x: 0, y: 0, z: 0 }, to: { x: 10, y: 10, z: 10 } },
|
|
37
|
+
* 1000,
|
|
38
|
+
* );
|
|
39
|
+
* // animate the target
|
|
40
|
+
* animator.play();
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Animate multiple targets (e.g. position and rotation) at once using an array.
|
|
44
|
+
* const animator = await animationSystem.fromTargets(
|
|
45
|
+
* [
|
|
46
|
+
* { position: { x: 0, y: 0, z: 0 }, to: { x: 10, y: 10, z: 10 } },
|
|
47
|
+
* { rotation: { x: 0, y: 0, z: 0 }, to: { x: 0, y: Math.PI / 2, z: 0 } },
|
|
48
|
+
* ],
|
|
49
|
+
* 1000,
|
|
50
|
+
* );
|
|
51
|
+
* // animate all targets in the array at once
|
|
52
|
+
* animator.play();
|
|
53
|
+
* @param targets - The targets to animate.
|
|
79
54
|
* @param duration - The duration of the animation in milliseconds.
|
|
80
55
|
* @param options - The options for the animation.
|
|
81
|
-
* @returns
|
|
56
|
+
* @returns Promise<TargetAnimator>.
|
|
57
|
+
*/
|
|
58
|
+
async fromTargets(t, a, s) {
|
|
59
|
+
const { TargetAnimator: o } = await import("../../chunks/TargetAnimator-DUqkkdVb.mjs"), r = new o(t, a, s);
|
|
60
|
+
return this._animators.set(r.uuid, r), r;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Creates a ClipAnimator and returns it asynchronously.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Animate a single clip (e.g. a single animation) at once.
|
|
67
|
+
* const animator = await animationSystem.fromClips(
|
|
68
|
+
* model,
|
|
69
|
+
* model.animations,
|
|
70
|
+
* );
|
|
71
|
+
* // plays first clip by default
|
|
72
|
+
* animator.play();
|
|
73
|
+
* // plays plays "Idle" clip by name
|
|
74
|
+
* animator.play("Idle");
|
|
75
|
+
*
|
|
76
|
+
* @param root - The root object to animate.
|
|
77
|
+
* @param clips - The animation clips to animate.
|
|
78
|
+
* @returns Promise<ClipAnimator>.
|
|
82
79
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return this._callbackMap.set(s.uuid, {
|
|
87
|
-
onUpdate: ((l = s.options) == null ? void 0 : l.onUpdate) ?? (() => {
|
|
88
|
-
}),
|
|
89
|
-
onComplete: ((o = s.options) == null ? void 0 : o.onComplete) ?? (() => {
|
|
90
|
-
})
|
|
91
|
-
}), this._createTween(s), s;
|
|
80
|
+
async fromClips(t, a) {
|
|
81
|
+
const { ClipAnimator: s } = await import("../../chunks/ClipAnimator-BL9qzfWl.mjs"), o = new s(t, a);
|
|
82
|
+
return this._animators.set(o.uuid, o), o;
|
|
92
83
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Removes an animator from the system.
|
|
86
|
+
*
|
|
87
|
+
* @param uuid - The UUID of the animator to remove.
|
|
88
|
+
*/
|
|
89
|
+
remove(t) {
|
|
90
|
+
const a = this._animators.get(t);
|
|
91
|
+
if (!a) {
|
|
92
|
+
console.warn(`Animator with uuid ${t} not found`);
|
|
96
93
|
return;
|
|
97
94
|
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
dispose() {
|
|
101
|
-
this._callbackMap.clear(), this._tweens.clear();
|
|
102
|
-
}
|
|
103
|
-
tick() {
|
|
104
|
-
this.TWEEN.update();
|
|
105
|
-
}
|
|
106
|
-
_createTween(e) {
|
|
107
|
-
var i;
|
|
108
|
-
const t = new this.TWEEN.Tween(e.object).to(e.to, e.duration).easing(((i = e.options) == null ? void 0 : i.easing) ?? this.TWEEN.Easing.Quadratic.Out).onUpdate((n, s) => {
|
|
109
|
-
var l;
|
|
110
|
-
(l = this._callbackMap.get(e.uuid)) == null || l.onUpdate(n, s);
|
|
111
|
-
}).onComplete((n) => {
|
|
112
|
-
var s;
|
|
113
|
-
(s = this._callbackMap.get(e.uuid)) == null || s.onComplete(n);
|
|
114
|
-
});
|
|
115
|
-
e.addEventListener("play", () => {
|
|
116
|
-
t.start();
|
|
117
|
-
}), e.addEventListener("stop", () => {
|
|
118
|
-
t.stop();
|
|
119
|
-
}), this._tweens.set(e.uuid, t);
|
|
95
|
+
a.dispose(), this._animators.delete(t);
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
98
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
c as TWEEN
|
|
99
|
+
l as AnimationSystem,
|
|
100
|
+
w as Easing
|
|
126
101
|
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { EventDispatcher
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { EventDispatcher } from 'three/src/core/EventDispatcher.js';
|
|
2
|
+
import { TAnimatorEventMap, TAnimatorLoopMode, TAnimatorState } from '../types/AnimatorTypes.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for all animation types.
|
|
5
|
+
*
|
|
6
|
+
* Provides a unified interface for controlling animations,
|
|
7
|
+
* regardless of the underlying implementation (Tween or AnimationClip).
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class Animator extends EventDispatcher<TAnimatorEventMap> {
|
|
12
12
|
private _uuid;
|
|
13
|
-
private _playing;
|
|
14
|
-
private _stopped;
|
|
15
|
-
private _completed;
|
|
16
|
-
constructor(object: T, to: T, duration: number, options?: TAnimatorParameters<T> | undefined);
|
|
17
13
|
get uuid(): string;
|
|
18
|
-
get
|
|
19
|
-
get
|
|
20
|
-
get
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
abstract get state(): TAnimatorState;
|
|
15
|
+
abstract get duration(): number;
|
|
16
|
+
abstract get loop(): TAnimatorLoopMode;
|
|
17
|
+
abstract set loop(value: TAnimatorLoopMode);
|
|
18
|
+
abstract get time(): number;
|
|
19
|
+
abstract set time(value: number);
|
|
20
|
+
abstract play(): this;
|
|
21
|
+
abstract pause(): this;
|
|
22
|
+
abstract resume(): this;
|
|
23
|
+
abstract stop(): this;
|
|
24
|
+
abstract update(deltaTime: number): void;
|
|
25
|
+
abstract dispose(): void;
|
|
24
26
|
}
|
|
25
|
-
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnimationClip, Object3D } from 'three';
|
|
2
|
+
import { Animator } from './Animator.ts';
|
|
3
|
+
import { TAnimatorLoopMode, TAnimatorState } from '../types/AnimatorTypes.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Animator for mesh-embedded AnimationClip playback (e.g. character animations, keyframe animations).
|
|
6
|
+
*
|
|
7
|
+
* Wraps Three.js AnimationMixer and AnimationAction into the unified Animator interface.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export declare class ClipAnimator extends Animator {
|
|
12
|
+
private _mixer;
|
|
13
|
+
private _actions;
|
|
14
|
+
private _currentAction;
|
|
15
|
+
private _state;
|
|
16
|
+
private _loop;
|
|
17
|
+
constructor(root: Object3D, clips: AnimationClip[]);
|
|
18
|
+
get state(): TAnimatorState;
|
|
19
|
+
get duration(): number;
|
|
20
|
+
get loop(): TAnimatorLoopMode;
|
|
21
|
+
set loop(value: TAnimatorLoopMode);
|
|
22
|
+
private _resolveLoopConstant;
|
|
23
|
+
get time(): number;
|
|
24
|
+
set time(value: number);
|
|
25
|
+
get clipNames(): string[];
|
|
26
|
+
get currentClipName(): string | null;
|
|
27
|
+
play(clipName?: string): this;
|
|
28
|
+
pause(): this;
|
|
29
|
+
resume(): this;
|
|
30
|
+
stop(): this;
|
|
31
|
+
update(deltaTime: number): void;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Animator } from './Animator.ts';
|
|
2
|
+
import { TAnimatorLoopMode, TAnimatorState } from '../types/AnimatorTypes.ts';
|
|
3
|
+
type EasingFunction = (amount: number) => number;
|
|
4
|
+
export type AnimationTarget = {
|
|
5
|
+
object: any;
|
|
6
|
+
to: any;
|
|
7
|
+
};
|
|
8
|
+
export type TargetAnimatorOptions = {
|
|
9
|
+
easing?: EasingFunction;
|
|
10
|
+
onUpdate?: () => void;
|
|
11
|
+
onComplete?: () => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Animator for programmatic target-based animations.
|
|
15
|
+
*
|
|
16
|
+
* Bundles multiple animation targets into a single logical animation unit
|
|
17
|
+
* using an isolated TWEEN.Group per instance.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
export declare class TargetAnimator extends Animator {
|
|
22
|
+
private _group;
|
|
23
|
+
private _tweens;
|
|
24
|
+
private _snapshots;
|
|
25
|
+
private _state;
|
|
26
|
+
private _duration;
|
|
27
|
+
private _loop;
|
|
28
|
+
private _options?;
|
|
29
|
+
private _completedCount;
|
|
30
|
+
constructor(targets: AnimationTarget | AnimationTarget[], duration: number, options?: TargetAnimatorOptions);
|
|
31
|
+
get state(): TAnimatorState;
|
|
32
|
+
get duration(): number;
|
|
33
|
+
get loop(): TAnimatorLoopMode;
|
|
34
|
+
set loop(value: TAnimatorLoopMode);
|
|
35
|
+
get time(): number;
|
|
36
|
+
set time(_value: number);
|
|
37
|
+
play(): this;
|
|
38
|
+
pause(): this;
|
|
39
|
+
resume(): this;
|
|
40
|
+
stop(): this;
|
|
41
|
+
update(): void;
|
|
42
|
+
private _restoreSnapshots;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from './system/AnimationSystem.ts';
|
|
2
|
-
export * from './
|
|
3
|
-
export
|
|
2
|
+
export * from './types/AnimatorTypes.ts';
|
|
3
|
+
export type { Animator } from './animator/Animator.ts';
|
|
4
|
+
export type { ClipAnimator } from './animator/ClipAnimator.ts';
|
|
5
|
+
export type { TargetAnimator, AnimationTarget, TargetAnimatorOptions, } from './animator/TargetAnimator.ts';
|
|
@@ -1,23 +1,145 @@
|
|
|
1
|
+
import { AnimationClip, Object3D } from 'three';
|
|
1
2
|
import { DIVETicker } from '../../../../index.ts';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type ClipAnimator = import('../animator/ClipAnimator.ts').ClipAnimator;
|
|
4
|
+
type TargetAnimator = import('../animator/TargetAnimator.ts').TargetAnimator;
|
|
5
|
+
type TargetAnimatorOptions = import('../animator/TargetAnimator.ts').TargetAnimatorOptions;
|
|
6
|
+
type AnimationTarget = import('../animator/TargetAnimator.ts').AnimationTarget;
|
|
7
|
+
/**
|
|
8
|
+
* Central animation system that manages all animators (target-based and clip-based).
|
|
9
|
+
*
|
|
10
|
+
* Create "to-target" animators with `fromTargets()` and "animation-clip" animators with `fromClips()`.
|
|
11
|
+
*
|
|
12
|
+
* Implements DIVETicker so it can be registered with DIVEClock for per-frame updates.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
5
16
|
export declare class AnimationSystem implements DIVETicker {
|
|
6
17
|
uuid: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
readonly Easing: Readonly<{
|
|
19
|
+
Linear: Readonly<{
|
|
20
|
+
In: (amount: number) => number;
|
|
21
|
+
Out: (amount: number) => number;
|
|
22
|
+
InOut: (amount: number) => number;
|
|
23
|
+
} & {
|
|
24
|
+
None: (amount: number) => number;
|
|
25
|
+
}>;
|
|
26
|
+
Quadratic: Readonly<{
|
|
27
|
+
In: (amount: number) => number;
|
|
28
|
+
Out: (amount: number) => number;
|
|
29
|
+
InOut: (amount: number) => number;
|
|
30
|
+
}>;
|
|
31
|
+
Cubic: Readonly<{
|
|
32
|
+
In: (amount: number) => number;
|
|
33
|
+
Out: (amount: number) => number;
|
|
34
|
+
InOut: (amount: number) => number;
|
|
35
|
+
}>;
|
|
36
|
+
Quartic: Readonly<{
|
|
37
|
+
In: (amount: number) => number;
|
|
38
|
+
Out: (amount: number) => number;
|
|
39
|
+
InOut: (amount: number) => number;
|
|
40
|
+
}>;
|
|
41
|
+
Quintic: Readonly<{
|
|
42
|
+
In: (amount: number) => number;
|
|
43
|
+
Out: (amount: number) => number;
|
|
44
|
+
InOut: (amount: number) => number;
|
|
45
|
+
}>;
|
|
46
|
+
Sinusoidal: Readonly<{
|
|
47
|
+
In: (amount: number) => number;
|
|
48
|
+
Out: (amount: number) => number;
|
|
49
|
+
InOut: (amount: number) => number;
|
|
50
|
+
}>;
|
|
51
|
+
Exponential: Readonly<{
|
|
52
|
+
In: (amount: number) => number;
|
|
53
|
+
Out: (amount: number) => number;
|
|
54
|
+
InOut: (amount: number) => number;
|
|
55
|
+
}>;
|
|
56
|
+
Circular: Readonly<{
|
|
57
|
+
In: (amount: number) => number;
|
|
58
|
+
Out: (amount: number) => number;
|
|
59
|
+
InOut: (amount: number) => number;
|
|
60
|
+
}>;
|
|
61
|
+
Elastic: Readonly<{
|
|
62
|
+
In: (amount: number) => number;
|
|
63
|
+
Out: (amount: number) => number;
|
|
64
|
+
InOut: (amount: number) => number;
|
|
65
|
+
}>;
|
|
66
|
+
Back: Readonly<{
|
|
67
|
+
In: (amount: number) => number;
|
|
68
|
+
Out: (amount: number) => number;
|
|
69
|
+
InOut: (amount: number) => number;
|
|
70
|
+
}>;
|
|
71
|
+
Bounce: Readonly<{
|
|
72
|
+
In: (amount: number) => number;
|
|
73
|
+
Out: (amount: number) => number;
|
|
74
|
+
InOut: (amount: number) => number;
|
|
75
|
+
}>;
|
|
76
|
+
generatePow(power?: number): {
|
|
77
|
+
In: (amount: number) => number;
|
|
78
|
+
Out: (amount: number) => number;
|
|
79
|
+
InOut: (amount: number) => number;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
82
|
+
private _animators;
|
|
83
|
+
dispose(): void;
|
|
84
|
+
tick(deltaTime: number): void;
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Use `fromTargets()` instead.
|
|
87
|
+
* @note This method also calls .play() on the animator automatically. This has been removed in fromTargets(). You have to call .play() independently after creating the animator.
|
|
88
|
+
*/
|
|
89
|
+
animate(targets: AnimationTarget | AnimationTarget[], duration: number, options?: TargetAnimatorOptions): Promise<TargetAnimator>;
|
|
10
90
|
/**
|
|
11
|
-
* Creates a
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
91
|
+
* Creates a TargetAnimator and returns it asynchronously.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* // Animate a single target (e.g. position).
|
|
95
|
+
* const animator = await animationSystem.fromTargets(
|
|
96
|
+
* { position: { x: 0, y: 0, z: 0 }, to: { x: 10, y: 10, z: 10 } },
|
|
97
|
+
* 1000,
|
|
98
|
+
* );
|
|
99
|
+
* // animate the target
|
|
100
|
+
* animator.play();
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // Animate multiple targets (e.g. position and rotation) at once using an array.
|
|
104
|
+
* const animator = await animationSystem.fromTargets(
|
|
105
|
+
* [
|
|
106
|
+
* { position: { x: 0, y: 0, z: 0 }, to: { x: 10, y: 10, z: 10 } },
|
|
107
|
+
* { rotation: { x: 0, y: 0, z: 0 }, to: { x: 0, y: Math.PI / 2, z: 0 } },
|
|
108
|
+
* ],
|
|
109
|
+
* 1000,
|
|
110
|
+
* );
|
|
111
|
+
* // animate all targets in the array at once
|
|
112
|
+
* animator.play();
|
|
113
|
+
* @param targets - The targets to animate.
|
|
14
114
|
* @param duration - The duration of the animation in milliseconds.
|
|
15
115
|
* @param options - The options for the animation.
|
|
16
|
-
* @returns
|
|
116
|
+
* @returns Promise<TargetAnimator>.
|
|
117
|
+
*/
|
|
118
|
+
fromTargets(targets: AnimationTarget | AnimationTarget[], duration: number, options?: TargetAnimatorOptions): Promise<TargetAnimator>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a ClipAnimator and returns it asynchronously.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* // Animate a single clip (e.g. a single animation) at once.
|
|
124
|
+
* const animator = await animationSystem.fromClips(
|
|
125
|
+
* model,
|
|
126
|
+
* model.animations,
|
|
127
|
+
* );
|
|
128
|
+
* // plays first clip by default
|
|
129
|
+
* animator.play();
|
|
130
|
+
* // plays plays "Idle" clip by name
|
|
131
|
+
* animator.play("Idle");
|
|
132
|
+
*
|
|
133
|
+
* @param root - The root object to animate.
|
|
134
|
+
* @param clips - The animation clips to animate.
|
|
135
|
+
* @returns Promise<ClipAnimator>.
|
|
136
|
+
*/
|
|
137
|
+
fromClips(root: Object3D, clips: AnimationClip[]): Promise<ClipAnimator>;
|
|
138
|
+
/**
|
|
139
|
+
* Removes an animator from the system.
|
|
140
|
+
*
|
|
141
|
+
* @param uuid - The UUID of the animator to remove.
|
|
17
142
|
*/
|
|
18
|
-
animate<T extends object>(object: T, to: T, duration: number, options?: TAnimatorParameters<T>): Animator<T>;
|
|
19
143
|
remove(uuid: string): void;
|
|
20
|
-
dispose(): void;
|
|
21
|
-
tick(): void;
|
|
22
|
-
private _createTween;
|
|
23
144
|
}
|
|
145
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Event } from 'three/src/core/EventDispatcher.js';
|
|
2
|
+
export type TAnimatorState = 'idle' | 'playing' | 'paused';
|
|
3
|
+
export type TAnimatorEventMap = {
|
|
4
|
+
play: Event;
|
|
5
|
+
pause: Event;
|
|
6
|
+
resume: Event;
|
|
7
|
+
stop: Event;
|
|
8
|
+
update: Event;
|
|
9
|
+
complete: Event;
|
|
10
|
+
};
|
|
11
|
+
export type TAnimatorLoopMode = 'once' | 'repeat' | 'pingpong';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var h=(o,e,r)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var l=(o,e,r)=>h(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../systeminfo/index.cjs"),A=require("../assetconverter/index.cjs"),O=require("../../chunks/AssetLoader-
|
|
1
|
+
"use strict";var f=Object.defineProperty;var h=(o,e,r)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var l=(o,e,r)=>h(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../systeminfo/index.cjs"),A=require("../assetconverter/index.cjs"),O=require("../../chunks/AssetLoader-Drtmvqgs.cjs"),w=require("../../chunks/AssetExporter-Bqv27MWV.cjs");var m=(o=>(o.AR_DESKTOP_PLATFORM_ERROR="ar-desktop-platform-error",o.AR_QUICK_LOOK_NOT_SAFARI_ERROR="ar-quicklook-not-safari-error",o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR="ar-quicklook-version-mismatch-error",o.AR_QUICK_LOOK_UNKNOWN_ERROR="ar-quicklook-unknown-error",o))(m||{});class a extends Error{constructor(r,t){super(r);l(this,"type");this.name=this.constructor.name,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}class R extends a{constructor(){super("AR features are not supported on desktop platforms.","ar-desktop-platform-error")}}class p extends a{constructor(){super("ARQuickLook on iOS is only available in Safari.","ar-quicklook-not-safari-error")}}class d extends a{constructor(e,r){super(`ARQuickLook requires iOS version ${r} or later. Current version: ${e}.`,"ar-quicklook-version-mismatch-error"),this.currentVersion=e,this.requiredVersion=r}}class u extends a{constructor(){super("An unknown ARQuickLook compatibility error occurred.","ar-quicklook-unknown-error")}}const k=12;class S{constructor(){l(this,"converter",new A.AssetConverter(new O.AssetLoader,new w.AssetExporter))}async launch(e,r){if(c.SystemInfo.getBrowser()!==c.EBrowser.SAFARI)return Promise.reject(new p);const t=c.SystemInfo.getIOSVersion();if(t&&t.major<k)return Promise.reject(new d(t.full,k));if(!t)return Promise.reject(new u);if(!c.SystemInfo.getSupportsARQuickLook())return Promise.reject(new u);const n=await this.convertToUSDZ(e,r);return this.launchARQuickLook(n,r)}async convertToUSDZ(e,r){const t=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}}),n=new Blob([t],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,r){return new Promise(t=>{(r==null?void 0:r.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",t(),n.click()})}}class _{launch(e,r){const t=self.location.toString(),n=document.createElement("a"),s=this._createParams(t,e,r),i=this._createIntent(t,e,s);n.setAttribute("href",i),n.click()}_createParams(e,r,t){const n=new URL(r,e),s=new URLSearchParams(n.search);return s.set("mode","ar_preferred"),this._applyScaleOption(s,t),this._applyPlacementOption(s,t),this._applySoundOption(s,e),this._applyLinkOption(s,e),s}_applyScaleOption(e,r){(r==null?void 0:r.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,r){(r==null?void 0:r.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,r){if(e.has("sound")){const t=new URL(e.get("sound"),r);e.set("sound",t.toString())}}_applyLinkOption(e,r){if(e.has("link")){const t=new URL(e.get("link"),r);e.set("link",t.toString())}}_createIntent(e,r,t){const n=new URL(e),s=new URL(r,e),i="#model-viewer-no-ar-fallback";return n.hash=i,`intent://arvr.google.com/scene-viewer/1.2?${t.toString()+"&file="+s.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class L{async launch(e,r){const t=c.SystemInfo.getSystem();return t===c.ESystem.IOS?new S().launch(e,r):t===c.ESystem.ANDROID?new _().launch(e,r):Promise.reject(new R)}}exports.ARDesktopPlatformError=R;exports.ARError=a;exports.ARQuickLook=S;exports.ARQuickLookNotSafariError=p;exports.ARQuickLookUnknownError=u;exports.ARQuickLookVersionMismatchError=d;exports.ARSystem=L;exports.EARErrorType=m;exports.SceneViewer=_;
|
|
@@ -3,8 +3,8 @@ var R = (o, e, r) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var l = (o, e, r) => R(o, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { SystemInfo as c, EBrowser as d, ESystem as u } from "../systeminfo/index.mjs";
|
|
5
5
|
import { AssetConverter as h } from "../assetconverter/index.mjs";
|
|
6
|
-
import { A as _ } from "../../chunks/AssetLoader-
|
|
7
|
-
import { A as f } from "../../chunks/AssetExporter-
|
|
6
|
+
import { A as _ } from "../../chunks/AssetLoader-Dcr75VNw.mjs";
|
|
7
|
+
import { A as f } from "../../chunks/AssetExporter-BBaDvZ8D.mjs";
|
|
8
8
|
var S = /* @__PURE__ */ ((o) => (o.AR_DESKTOP_PLATFORM_ERROR = "ar-desktop-platform-error", o.AR_QUICK_LOOK_NOT_SAFARI_ERROR = "ar-quicklook-not-safari-error", o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR = "ar-quicklook-version-mismatch-error", o.AR_QUICK_LOOK_UNKNOWN_ERROR = "ar-quicklook-unknown-error", o))(S || {});
|
|
9
9
|
class a extends Error {
|
|
10
10
|
constructor(r, t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetCache-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetCache-BZhTsybC.cjs");exports.AssetCache=e.AssetCache;exports.Chunk=e.Chunk;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetExporter-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetExporter-Bqv27MWV.cjs");exports.AssetExporter=e.AssetExporter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetLoader-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetLoader-Drtmvqgs.cjs");exports.AssetLoader=e.AssetLoader;exports.DRACOWorker=e.DRACOWorker;exports.DracoLoader=e.DracoLoader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as o } from "../../chunks/AssetLoader-
|
|
2
|
-
import { D as s, a as t } from "../../chunks/AssetLoader-
|
|
1
|
+
import { A as o } from "../../chunks/AssetLoader-Dcr75VNw.mjs";
|
|
2
|
+
import { D as s, a as t } from "../../chunks/AssetLoader-Dcr75VNw.mjs";
|
|
3
3
|
export {
|
|
4
4
|
o as AssetLoader,
|
|
5
5
|
s as DRACOWorker,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/FileTypes-35x8Ekp6.cjs");exports.OrbitController=t.OrbitController;exports.OrbitControllerDefaultSettings=t.OrbitControllerDefaultSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var p=(s,e,r)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var a=(s,e,r)=>p(s,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three");require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";var c=Object.defineProperty;var p=(s,e,r)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var a=(s,e,r)=>p(s,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three");require("../../chunks/FileTypes-35x8Ekp6.cjs");const n=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),i=require("../../chunks/AxisHelperColors-BrGqktN5.cjs"),l=require("three-spritetext");class _ extends t.Object3D{constructor(){super();a(this,"_axesHelper");this._axesHelper=new t.AxesHelper(.5),this._axesHelper.layers.mask=n.COORDINATE_LAYER_MASK,this._axesHelper.material.depthTest=!1,this._axesHelper.position.set(0,0,-1),this._axesHelper.setColors(new t.Color(i.AxesColorRed),new t.Color(i.AxesColorGreen),new t.Color(i.AxesColorBlue));const r=new l("X",.2,i.AxesColorRedLetter),o=new l("Y",.2,i.AxesColorGreenLetter),h=new l("Z",.2,i.AxesColorBlueLetter);r.layers.mask=n.COORDINATE_LAYER_MASK,o.layers.mask=n.COORDINATE_LAYER_MASK,h.layers.mask=n.COORDINATE_LAYER_MASK,r.position.set(.7,0,0),o.position.set(0,.7,0),h.position.set(0,0,.7),this._axesHelper.add(r),this._axesHelper.add(o),this._axesHelper.add(h),this.add(this._axesHelper)}setFromCameraMatrix(r){this._axesHelper.rotation.setFromRotationMatrix(new t.Matrix4().extractRotation(r).invert())}}class d{constructor(e,r,o){a(this,"uuid",t.MathUtils.generateUUID());a(this,"_axes");a(this,"_orthographicCamera");a(this,"_restoreViewport",new t.Vector4);this._renderer=e,this._scene=r,this._camera=o,this._orthographicCamera=new t.OrthographicCamera(-1,1,1,-1,.1,100),this._orthographicCamera.name="OrientationDisplayCamera",this._orthographicCamera.layers.mask=n.COORDINATE_LAYER_MASK,this._scene.add(this._orthographicCamera),this._axes=new _,this._axes.name="OrientationDisplayAxes",this._scene.add(this._axes)}tick(){const e=this._scene.background??null;this._scene.background=null,this._renderer.webglrenderer.getViewport(this._restoreViewport),this._renderer.webglrenderer.setViewport(0,0,150,150),this._renderer.webglrenderer.autoClear=!1,this._axes.setFromCameraMatrix(this._camera.matrix),this._renderer.webglrenderer.render(this._scene,this._orthographicCamera),this._renderer.webglrenderer.setViewport(this._restoreViewport),this._renderer.webglrenderer.autoClear=!0,this._scene.background=e}dispose(){this._scene.remove(this._axes),this._scene.remove(this._orthographicCamera)}}exports.OrientationDisplay=d;exports.OrientationDisplayAxes=_;
|
|
@@ -2,7 +2,7 @@ var l = Object.defineProperty;
|
|
|
2
2
|
var _ = (s, e, r) => e in s ? l(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
|
|
3
3
|
var t = (s, e, r) => _(s, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { Object3D as p, AxesHelper as c, Color as n, Matrix4 as d, OrthographicCamera as m, MathUtils as x, Vector4 as w } from "three";
|
|
5
|
-
import "../../chunks/FileTypes-
|
|
5
|
+
import "../../chunks/FileTypes-BSG8CC2s.mjs";
|
|
6
6
|
import { C as i } from "../../chunks/PerspectiveCamera-BFzE2TQU.mjs";
|
|
7
7
|
import { A as C, a as g, b as u, c as A, d as H, e as b } from "../../chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
8
8
|
import h from "three-spritetext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../chunks/FileTypes-35x8Ekp6.cjs");require("three");const r={...o.DIVEDefaultSettings},l=async(n,c)=>{const e=new o.DIVE(c);e.mainView.camera.position.set(0,1,2);const i=await new o.DIVEModel().setFromURL(n);e.scene.root.add(i),i.placeOnFloor();const t=new o.OrbitController(e.mainView.camera,e.mainView.canvas);t.focusObject(i),e.clock.addTicker(t);const s=Object.assign(e,{orbitController:t,model:i}),a=e.dispose.bind(e);return s.dispose=async()=>{t.dispose(),await a()},s};exports.QuickView=l;exports.QuickViewDefaultSettings=r;
|