@babylonjs/viewer 5.0.0 → 5.0.3
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/configuration/configuration.d.ts +107 -107
- package/configuration/configuration.js +15 -15
- package/configuration/configurationCompatibility.d.ts +8 -8
- package/configuration/configurationCompatibility.js +65 -65
- package/configuration/configurationContainer.d.ts +10 -10
- package/configuration/configurationContainer.js +9 -9
- package/configuration/globals.d.ts +6 -6
- package/configuration/globals.js +17 -17
- package/configuration/index.d.ts +2 -2
- package/configuration/index.js +3 -3
- package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
- package/configuration/interfaces/cameraConfiguration.js +1 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
- package/configuration/interfaces/colorGradingConfiguration.js +1 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
- package/configuration/interfaces/environmentMapConfiguration.js +1 -1
- package/configuration/interfaces/groundConfiguration.d.ts +24 -24
- package/configuration/interfaces/groundConfiguration.js +1 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
- package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
- package/configuration/interfaces/index.d.ts +15 -15
- package/configuration/interfaces/index.js +15 -15
- package/configuration/interfaces/lightConfiguration.d.ts +60 -60
- package/configuration/interfaces/lightConfiguration.js +1 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
- package/configuration/interfaces/modelConfiguration.d.ts +65 -65
- package/configuration/interfaces/modelConfiguration.js +1 -1
- package/configuration/interfaces/observersConfiguration.d.ts +5 -5
- package/configuration/interfaces/observersConfiguration.js +1 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
- package/configuration/interfaces/sceneConfiguration.js +1 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
- package/configuration/interfaces/skyboxConfiguration.js +1 -1
- package/configuration/interfaces/templateConfiguration.d.ts +67 -67
- package/configuration/interfaces/templateConfiguration.js +1 -1
- package/configuration/interfaces/vrConfiguration.d.ts +16 -16
- package/configuration/interfaces/vrConfiguration.js +1 -1
- package/configuration/loader.d.ts +4 -4
- package/configuration/loader.js +16 -16
- package/configuration/mappers.d.ts +42 -42
- package/configuration/mappers.js +190 -190
- package/configuration/renderOnlyLoader.d.ts +33 -33
- package/configuration/renderOnlyLoader.js +161 -161
- package/configuration/types/default.d.ts +6 -6
- package/configuration/types/default.js +120 -120
- package/configuration/types/environmentMap.d.ts +5 -5
- package/configuration/types/environmentMap.js +13 -13
- package/configuration/types/extended.d.ts +6 -6
- package/configuration/types/extended.js +316 -316
- package/configuration/types/index.d.ts +13 -13
- package/configuration/types/index.js +49 -49
- package/configuration/types/minimal.d.ts +6 -6
- package/configuration/types/minimal.js +42 -42
- package/configuration/types/renderOnlyDefault.d.ts +30 -30
- package/configuration/types/renderOnlyDefault.js +30 -30
- package/configuration/types/shadowLight.d.ts +9 -9
- package/configuration/types/shadowLight.js +63 -63
- package/helper/index.d.ts +26 -26
- package/helper/index.js +62 -62
- package/index.d.ts +30 -30
- package/index.js +45 -45
- package/initializer.d.ts +11 -11
- package/initializer.js +34 -34
- package/interfaces.d.ts +5 -5
- package/interfaces.js +1 -1
- package/labs/environmentSerializer.d.ts +126 -126
- package/labs/environmentSerializer.js +190 -190
- package/labs/texture.d.ts +183 -183
- package/labs/texture.js +300 -300
- package/labs/viewerLabs.d.ts +51 -51
- package/labs/viewerLabs.js +133 -133
- package/loader/modelLoader.d.ts +47 -47
- package/loader/modelLoader.js +189 -189
- package/loader/plugins/applyMaterialConfig.d.ts +12 -12
- package/loader/plugins/applyMaterialConfig.js +15 -15
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
- package/loader/plugins/index.d.ts +18 -18
- package/loader/plugins/index.js +42 -42
- package/loader/plugins/loaderPlugin.d.ts +24 -24
- package/loader/plugins/loaderPlugin.js +1 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
- package/loader/plugins/msftLodLoaderPlugin.js +20 -20
- package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
- package/loader/plugins/telemetryLoaderPlugin.js +35 -35
- package/managers/observablesManager.d.ts +66 -66
- package/managers/observablesManager.js +34 -34
- package/managers/sceneManager.d.ts +243 -243
- package/managers/sceneManager.js +1388 -1388
- package/managers/telemetryManager.d.ts +57 -57
- package/managers/telemetryManager.js +113 -113
- package/model/modelAnimation.d.ts +215 -215
- package/model/modelAnimation.js +232 -232
- package/model/viewerModel.d.ts +228 -228
- package/model/viewerModel.js +669 -669
- package/optimizer/custom/extended.d.ts +11 -11
- package/optimizer/custom/extended.js +98 -98
- package/optimizer/custom/index.d.ts +8 -8
- package/optimizer/custom/index.js +24 -24
- package/package.json +5 -5
- package/renderOnlyIndex.d.ts +11 -11
- package/renderOnlyIndex.js +17 -17
- package/templating/eventManager.d.ts +35 -35
- package/templating/eventManager.js +65 -65
- package/templating/plugins/hdButtonPlugin.d.ts +9 -9
- package/templating/plugins/hdButtonPlugin.js +21 -21
- package/templating/plugins/printButton.d.ts +9 -9
- package/templating/plugins/printButton.js +40 -40
- package/templating/templateManager.d.ts +190 -190
- package/templating/templateManager.js +553 -553
- package/templating/viewerTemplatePlugin.d.ts +21 -21
- package/templating/viewerTemplatePlugin.js +68 -68
- package/viewer/defaultViewer.d.ts +122 -122
- package/viewer/defaultViewer.js +665 -665
- package/viewer/renderOnlyViewer.d.ts +8 -8
- package/viewer/renderOnlyViewer.js +43 -43
- package/viewer/viewer.d.ts +254 -254
- package/viewer/viewer.js +777 -777
- package/viewer/viewerManager.d.ts +55 -55
- package/viewer/viewerManager.js +87 -87
- package/viewer/viewerWithTemplate.d.ts +9 -9
- package/viewer/viewerWithTemplate.js +19 -19
package/model/modelAnimation.js
CHANGED
|
@@ -1,233 +1,233 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animation play mode enum - is the animation looping or playing once
|
|
3
|
-
*/
|
|
4
|
-
export var AnimationPlayMode;
|
|
5
|
-
(function (AnimationPlayMode) {
|
|
6
|
-
AnimationPlayMode[AnimationPlayMode["ONCE"] = 0] = "ONCE";
|
|
7
|
-
AnimationPlayMode[AnimationPlayMode["LOOP"] = 1] = "LOOP";
|
|
8
|
-
})(AnimationPlayMode || (AnimationPlayMode = {}));
|
|
9
|
-
/**
|
|
10
|
-
* An enum representing the current state of an animation object
|
|
11
|
-
*/
|
|
12
|
-
export var AnimationState;
|
|
13
|
-
(function (AnimationState) {
|
|
14
|
-
AnimationState[AnimationState["INIT"] = 0] = "INIT";
|
|
15
|
-
AnimationState[AnimationState["PLAYING"] = 1] = "PLAYING";
|
|
16
|
-
AnimationState[AnimationState["PAUSED"] = 2] = "PAUSED";
|
|
17
|
-
AnimationState[AnimationState["STOPPED"] = 3] = "STOPPED";
|
|
18
|
-
AnimationState[AnimationState["ENDED"] = 4] = "ENDED";
|
|
19
|
-
})(AnimationState || (AnimationState = {}));
|
|
20
|
-
/**
|
|
21
|
-
* The different type of easing functions available
|
|
22
|
-
*/
|
|
23
|
-
export var EasingFunction;
|
|
24
|
-
(function (EasingFunction) {
|
|
25
|
-
EasingFunction[EasingFunction["Linear"] = 0] = "Linear";
|
|
26
|
-
EasingFunction[EasingFunction["CircleEase"] = 1] = "CircleEase";
|
|
27
|
-
EasingFunction[EasingFunction["BackEase"] = 2] = "BackEase";
|
|
28
|
-
EasingFunction[EasingFunction["BounceEase"] = 3] = "BounceEase";
|
|
29
|
-
EasingFunction[EasingFunction["CubicEase"] = 4] = "CubicEase";
|
|
30
|
-
EasingFunction[EasingFunction["ElasticEase"] = 5] = "ElasticEase";
|
|
31
|
-
EasingFunction[EasingFunction["ExponentialEase"] = 6] = "ExponentialEase";
|
|
32
|
-
EasingFunction[EasingFunction["PowerEase"] = 7] = "PowerEase";
|
|
33
|
-
EasingFunction[EasingFunction["QuadraticEase"] = 8] = "QuadraticEase";
|
|
34
|
-
EasingFunction[EasingFunction["QuarticEase"] = 9] = "QuarticEase";
|
|
35
|
-
EasingFunction[EasingFunction["QuinticEase"] = 10] = "QuinticEase";
|
|
36
|
-
EasingFunction[EasingFunction["SineEase"] = 11] = "SineEase";
|
|
37
|
-
})(EasingFunction || (EasingFunction = {}));
|
|
38
|
-
/**
|
|
39
|
-
* The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
|
|
40
|
-
* native GroupAnimation class.
|
|
41
|
-
*/
|
|
42
|
-
var GroupModelAnimation = /** @class */ (function () {
|
|
43
|
-
/**
|
|
44
|
-
* Create a new GroupModelAnimation object using an AnimationGroup object
|
|
45
|
-
* @param _animationGroup The animation group to base the class on
|
|
46
|
-
*/
|
|
47
|
-
function GroupModelAnimation(_animationGroup) {
|
|
48
|
-
var _this = this;
|
|
49
|
-
this._animationGroup = _animationGroup;
|
|
50
|
-
this._state = AnimationState.INIT;
|
|
51
|
-
this._playMode = AnimationPlayMode.LOOP;
|
|
52
|
-
this._animationGroup.onAnimationEndObservable.add(function () {
|
|
53
|
-
_this.stop();
|
|
54
|
-
_this._state = AnimationState.ENDED;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
Object.defineProperty(GroupModelAnimation.prototype, "name", {
|
|
58
|
-
/**
|
|
59
|
-
* Get the animation's name
|
|
60
|
-
*/
|
|
61
|
-
get: function () {
|
|
62
|
-
return this._animationGroup.name;
|
|
63
|
-
},
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(GroupModelAnimation.prototype, "state", {
|
|
68
|
-
/**
|
|
69
|
-
* Get the current animation's state
|
|
70
|
-
*/
|
|
71
|
-
get: function () {
|
|
72
|
-
return this._state;
|
|
73
|
-
},
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(GroupModelAnimation.prototype, "speedRatio", {
|
|
78
|
-
/**
|
|
79
|
-
* Gets the speed ratio to use for all animations
|
|
80
|
-
*/
|
|
81
|
-
get: function () {
|
|
82
|
-
return this._animationGroup.speedRatio;
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* Sets the speed ratio to use for all animations
|
|
86
|
-
*/
|
|
87
|
-
set: function (value) {
|
|
88
|
-
this._animationGroup.speedRatio = value;
|
|
89
|
-
},
|
|
90
|
-
enumerable: false,
|
|
91
|
-
configurable: true
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(GroupModelAnimation.prototype, "frames", {
|
|
94
|
-
/**
|
|
95
|
-
* Get the max numbers of frame available in the animation group
|
|
96
|
-
*
|
|
97
|
-
* In correlation to an array, this would be ".length"
|
|
98
|
-
*/
|
|
99
|
-
get: function () {
|
|
100
|
-
return this._animationGroup.to - this._animationGroup.from;
|
|
101
|
-
},
|
|
102
|
-
enumerable: false,
|
|
103
|
-
configurable: true
|
|
104
|
-
});
|
|
105
|
-
Object.defineProperty(GroupModelAnimation.prototype, "currentFrame", {
|
|
106
|
-
/**
|
|
107
|
-
* Get the current frame playing right now.
|
|
108
|
-
* This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)
|
|
109
|
-
*
|
|
110
|
-
* In correlation to an array, this would be the current index
|
|
111
|
-
*/
|
|
112
|
-
get: function () {
|
|
113
|
-
if (this._animationGroup.targetedAnimations[0] && this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0]) {
|
|
114
|
-
return this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame - this._animationGroup.from;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return 0;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
enumerable: false,
|
|
121
|
-
configurable: true
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(GroupModelAnimation.prototype, "fps", {
|
|
124
|
-
/**
|
|
125
|
-
* Get the FPS value of this animation
|
|
126
|
-
*/
|
|
127
|
-
get: function () {
|
|
128
|
-
// get the first currentFrame found
|
|
129
|
-
for (var i = 0; i < this._animationGroup.animatables.length; ++i) {
|
|
130
|
-
var animatable = this._animationGroup.animatables[i];
|
|
131
|
-
var animations = animatable.getAnimations();
|
|
132
|
-
if (!animations || !animations.length) {
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
for (var idx = 0; idx < animations.length; ++idx) {
|
|
136
|
-
if (animations[idx].animation && animations[idx].animation.framePerSecond) {
|
|
137
|
-
return animations[idx].animation.framePerSecond;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return 0;
|
|
142
|
-
},
|
|
143
|
-
enumerable: false,
|
|
144
|
-
configurable: true
|
|
145
|
-
});
|
|
146
|
-
Object.defineProperty(GroupModelAnimation.prototype, "playMode", {
|
|
147
|
-
/**
|
|
148
|
-
* What is the animation'S play mode (looping or played once)
|
|
149
|
-
*/
|
|
150
|
-
get: function () {
|
|
151
|
-
return this._playMode;
|
|
152
|
-
},
|
|
153
|
-
/**
|
|
154
|
-
* Set the play mode.
|
|
155
|
-
* If the animation is played, it will continue playing at least once more, depending on the new play mode set.
|
|
156
|
-
* If the animation is not set, the will be initialized and will wait for the user to start playing it.
|
|
157
|
-
*/
|
|
158
|
-
set: function (value) {
|
|
159
|
-
if (value === this._playMode) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this._playMode = value;
|
|
163
|
-
if (this.state === AnimationState.PLAYING) {
|
|
164
|
-
this._animationGroup.play(this._playMode === AnimationPlayMode.LOOP);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
this._animationGroup.reset();
|
|
168
|
-
this._state = AnimationState.INIT;
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
enumerable: false,
|
|
172
|
-
configurable: true
|
|
173
|
-
});
|
|
174
|
-
/**
|
|
175
|
-
* Reset the animation group
|
|
176
|
-
*/
|
|
177
|
-
GroupModelAnimation.prototype.reset = function () {
|
|
178
|
-
this._animationGroup.reset();
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* Restart the animation group
|
|
182
|
-
*/
|
|
183
|
-
GroupModelAnimation.prototype.restart = function () {
|
|
184
|
-
if (this.state === AnimationState.PAUSED) {
|
|
185
|
-
this._animationGroup.restart();
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
this.start();
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
*
|
|
193
|
-
* @param frameNumber Go to a specific frame in the animation
|
|
194
|
-
*/
|
|
195
|
-
GroupModelAnimation.prototype.goToFrame = function (frameNumber) {
|
|
196
|
-
this._animationGroup.goToFrame(frameNumber + this._animationGroup.from);
|
|
197
|
-
};
|
|
198
|
-
/**
|
|
199
|
-
* Start playing the animation.
|
|
200
|
-
*/
|
|
201
|
-
GroupModelAnimation.prototype.start = function () {
|
|
202
|
-
this._animationGroup.start(this.playMode === AnimationPlayMode.LOOP, this.speedRatio);
|
|
203
|
-
if (this._animationGroup.isStarted) {
|
|
204
|
-
this._state = AnimationState.PLAYING;
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* Pause the animation
|
|
209
|
-
*/
|
|
210
|
-
GroupModelAnimation.prototype.pause = function () {
|
|
211
|
-
this._animationGroup.pause();
|
|
212
|
-
this._state = AnimationState.PAUSED;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Stop the animation.
|
|
216
|
-
* This will fail silently if the animation group is already stopped.
|
|
217
|
-
*/
|
|
218
|
-
GroupModelAnimation.prototype.stop = function () {
|
|
219
|
-
this._animationGroup.stop();
|
|
220
|
-
if (!this._animationGroup.isStarted) {
|
|
221
|
-
this._state = AnimationState.STOPPED;
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Dispose this animation object.
|
|
226
|
-
*/
|
|
227
|
-
GroupModelAnimation.prototype.dispose = function () {
|
|
228
|
-
this._animationGroup.dispose();
|
|
229
|
-
};
|
|
230
|
-
return GroupModelAnimation;
|
|
231
|
-
}());
|
|
232
|
-
export { GroupModelAnimation };
|
|
1
|
+
/**
|
|
2
|
+
* Animation play mode enum - is the animation looping or playing once
|
|
3
|
+
*/
|
|
4
|
+
export var AnimationPlayMode;
|
|
5
|
+
(function (AnimationPlayMode) {
|
|
6
|
+
AnimationPlayMode[AnimationPlayMode["ONCE"] = 0] = "ONCE";
|
|
7
|
+
AnimationPlayMode[AnimationPlayMode["LOOP"] = 1] = "LOOP";
|
|
8
|
+
})(AnimationPlayMode || (AnimationPlayMode = {}));
|
|
9
|
+
/**
|
|
10
|
+
* An enum representing the current state of an animation object
|
|
11
|
+
*/
|
|
12
|
+
export var AnimationState;
|
|
13
|
+
(function (AnimationState) {
|
|
14
|
+
AnimationState[AnimationState["INIT"] = 0] = "INIT";
|
|
15
|
+
AnimationState[AnimationState["PLAYING"] = 1] = "PLAYING";
|
|
16
|
+
AnimationState[AnimationState["PAUSED"] = 2] = "PAUSED";
|
|
17
|
+
AnimationState[AnimationState["STOPPED"] = 3] = "STOPPED";
|
|
18
|
+
AnimationState[AnimationState["ENDED"] = 4] = "ENDED";
|
|
19
|
+
})(AnimationState || (AnimationState = {}));
|
|
20
|
+
/**
|
|
21
|
+
* The different type of easing functions available
|
|
22
|
+
*/
|
|
23
|
+
export var EasingFunction;
|
|
24
|
+
(function (EasingFunction) {
|
|
25
|
+
EasingFunction[EasingFunction["Linear"] = 0] = "Linear";
|
|
26
|
+
EasingFunction[EasingFunction["CircleEase"] = 1] = "CircleEase";
|
|
27
|
+
EasingFunction[EasingFunction["BackEase"] = 2] = "BackEase";
|
|
28
|
+
EasingFunction[EasingFunction["BounceEase"] = 3] = "BounceEase";
|
|
29
|
+
EasingFunction[EasingFunction["CubicEase"] = 4] = "CubicEase";
|
|
30
|
+
EasingFunction[EasingFunction["ElasticEase"] = 5] = "ElasticEase";
|
|
31
|
+
EasingFunction[EasingFunction["ExponentialEase"] = 6] = "ExponentialEase";
|
|
32
|
+
EasingFunction[EasingFunction["PowerEase"] = 7] = "PowerEase";
|
|
33
|
+
EasingFunction[EasingFunction["QuadraticEase"] = 8] = "QuadraticEase";
|
|
34
|
+
EasingFunction[EasingFunction["QuarticEase"] = 9] = "QuarticEase";
|
|
35
|
+
EasingFunction[EasingFunction["QuinticEase"] = 10] = "QuinticEase";
|
|
36
|
+
EasingFunction[EasingFunction["SineEase"] = 11] = "SineEase";
|
|
37
|
+
})(EasingFunction || (EasingFunction = {}));
|
|
38
|
+
/**
|
|
39
|
+
* The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
|
|
40
|
+
* native GroupAnimation class.
|
|
41
|
+
*/
|
|
42
|
+
var GroupModelAnimation = /** @class */ (function () {
|
|
43
|
+
/**
|
|
44
|
+
* Create a new GroupModelAnimation object using an AnimationGroup object
|
|
45
|
+
* @param _animationGroup The animation group to base the class on
|
|
46
|
+
*/
|
|
47
|
+
function GroupModelAnimation(_animationGroup) {
|
|
48
|
+
var _this = this;
|
|
49
|
+
this._animationGroup = _animationGroup;
|
|
50
|
+
this._state = AnimationState.INIT;
|
|
51
|
+
this._playMode = AnimationPlayMode.LOOP;
|
|
52
|
+
this._animationGroup.onAnimationEndObservable.add(function () {
|
|
53
|
+
_this.stop();
|
|
54
|
+
_this._state = AnimationState.ENDED;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
Object.defineProperty(GroupModelAnimation.prototype, "name", {
|
|
58
|
+
/**
|
|
59
|
+
* Get the animation's name
|
|
60
|
+
*/
|
|
61
|
+
get: function () {
|
|
62
|
+
return this._animationGroup.name;
|
|
63
|
+
},
|
|
64
|
+
enumerable: false,
|
|
65
|
+
configurable: true
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(GroupModelAnimation.prototype, "state", {
|
|
68
|
+
/**
|
|
69
|
+
* Get the current animation's state
|
|
70
|
+
*/
|
|
71
|
+
get: function () {
|
|
72
|
+
return this._state;
|
|
73
|
+
},
|
|
74
|
+
enumerable: false,
|
|
75
|
+
configurable: true
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(GroupModelAnimation.prototype, "speedRatio", {
|
|
78
|
+
/**
|
|
79
|
+
* Gets the speed ratio to use for all animations
|
|
80
|
+
*/
|
|
81
|
+
get: function () {
|
|
82
|
+
return this._animationGroup.speedRatio;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Sets the speed ratio to use for all animations
|
|
86
|
+
*/
|
|
87
|
+
set: function (value) {
|
|
88
|
+
this._animationGroup.speedRatio = value;
|
|
89
|
+
},
|
|
90
|
+
enumerable: false,
|
|
91
|
+
configurable: true
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(GroupModelAnimation.prototype, "frames", {
|
|
94
|
+
/**
|
|
95
|
+
* Get the max numbers of frame available in the animation group
|
|
96
|
+
*
|
|
97
|
+
* In correlation to an array, this would be ".length"
|
|
98
|
+
*/
|
|
99
|
+
get: function () {
|
|
100
|
+
return this._animationGroup.to - this._animationGroup.from;
|
|
101
|
+
},
|
|
102
|
+
enumerable: false,
|
|
103
|
+
configurable: true
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(GroupModelAnimation.prototype, "currentFrame", {
|
|
106
|
+
/**
|
|
107
|
+
* Get the current frame playing right now.
|
|
108
|
+
* This can be used to poll the frame currently playing (and, for example, display a progress bar with the data)
|
|
109
|
+
*
|
|
110
|
+
* In correlation to an array, this would be the current index
|
|
111
|
+
*/
|
|
112
|
+
get: function () {
|
|
113
|
+
if (this._animationGroup.targetedAnimations[0] && this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0]) {
|
|
114
|
+
return this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame - this._animationGroup.from;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
enumerable: false,
|
|
121
|
+
configurable: true
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(GroupModelAnimation.prototype, "fps", {
|
|
124
|
+
/**
|
|
125
|
+
* Get the FPS value of this animation
|
|
126
|
+
*/
|
|
127
|
+
get: function () {
|
|
128
|
+
// get the first currentFrame found
|
|
129
|
+
for (var i = 0; i < this._animationGroup.animatables.length; ++i) {
|
|
130
|
+
var animatable = this._animationGroup.animatables[i];
|
|
131
|
+
var animations = animatable.getAnimations();
|
|
132
|
+
if (!animations || !animations.length) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
for (var idx = 0; idx < animations.length; ++idx) {
|
|
136
|
+
if (animations[idx].animation && animations[idx].animation.framePerSecond) {
|
|
137
|
+
return animations[idx].animation.framePerSecond;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return 0;
|
|
142
|
+
},
|
|
143
|
+
enumerable: false,
|
|
144
|
+
configurable: true
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(GroupModelAnimation.prototype, "playMode", {
|
|
147
|
+
/**
|
|
148
|
+
* What is the animation'S play mode (looping or played once)
|
|
149
|
+
*/
|
|
150
|
+
get: function () {
|
|
151
|
+
return this._playMode;
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Set the play mode.
|
|
155
|
+
* If the animation is played, it will continue playing at least once more, depending on the new play mode set.
|
|
156
|
+
* If the animation is not set, the will be initialized and will wait for the user to start playing it.
|
|
157
|
+
*/
|
|
158
|
+
set: function (value) {
|
|
159
|
+
if (value === this._playMode) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this._playMode = value;
|
|
163
|
+
if (this.state === AnimationState.PLAYING) {
|
|
164
|
+
this._animationGroup.play(this._playMode === AnimationPlayMode.LOOP);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
this._animationGroup.reset();
|
|
168
|
+
this._state = AnimationState.INIT;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
enumerable: false,
|
|
172
|
+
configurable: true
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* Reset the animation group
|
|
176
|
+
*/
|
|
177
|
+
GroupModelAnimation.prototype.reset = function () {
|
|
178
|
+
this._animationGroup.reset();
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Restart the animation group
|
|
182
|
+
*/
|
|
183
|
+
GroupModelAnimation.prototype.restart = function () {
|
|
184
|
+
if (this.state === AnimationState.PAUSED) {
|
|
185
|
+
this._animationGroup.restart();
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
this.start();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* @param frameNumber Go to a specific frame in the animation
|
|
194
|
+
*/
|
|
195
|
+
GroupModelAnimation.prototype.goToFrame = function (frameNumber) {
|
|
196
|
+
this._animationGroup.goToFrame(frameNumber + this._animationGroup.from);
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Start playing the animation.
|
|
200
|
+
*/
|
|
201
|
+
GroupModelAnimation.prototype.start = function () {
|
|
202
|
+
this._animationGroup.start(this.playMode === AnimationPlayMode.LOOP, this.speedRatio);
|
|
203
|
+
if (this._animationGroup.isStarted) {
|
|
204
|
+
this._state = AnimationState.PLAYING;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Pause the animation
|
|
209
|
+
*/
|
|
210
|
+
GroupModelAnimation.prototype.pause = function () {
|
|
211
|
+
this._animationGroup.pause();
|
|
212
|
+
this._state = AnimationState.PAUSED;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Stop the animation.
|
|
216
|
+
* This will fail silently if the animation group is already stopped.
|
|
217
|
+
*/
|
|
218
|
+
GroupModelAnimation.prototype.stop = function () {
|
|
219
|
+
this._animationGroup.stop();
|
|
220
|
+
if (!this._animationGroup.isStarted) {
|
|
221
|
+
this._state = AnimationState.STOPPED;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Dispose this animation object.
|
|
226
|
+
*/
|
|
227
|
+
GroupModelAnimation.prototype.dispose = function () {
|
|
228
|
+
this._animationGroup.dispose();
|
|
229
|
+
};
|
|
230
|
+
return GroupModelAnimation;
|
|
231
|
+
}());
|
|
232
|
+
export { GroupModelAnimation };
|
|
233
233
|
//# sourceMappingURL=modelAnimation.js.map
|