You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGES.md
+1
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ Change Log
2
2
==========
3
3
### 1.38 - 2017-10-02
4
4
5
+
* Added ability to add an animation to `ModelAnimationCollection` by its index. [#5815](https://github.com/AnalyticalGraphicsInc/cesium/pull/5815)
5
6
* Fixed a bug in `ModelAnimationCollection` that caused adding an animation by its name to throw an error. [#5815](https://github.com/AnalyticalGraphicsInc/cesium/pull/5815)
Copy file name to clipboardexpand all lines: Source/Scene/ModelAnimationCollection.js
+20-5
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,8 @@ define([
99
99
* </p>
100
100
*
101
101
* @param {Object} options Object with the following properties:
102
-
* @param {String} options.name The glTF animation name that identifies the animation.
102
+
* @param {String} [options.name] The glTF animation name that identifies the animation. Must be defined if <code>options.id</code> is <code>undefined</code>.
103
+
* @param {Number} [options.index] The glTF animation index that identifies the animation. Must be defined if <code>options.name</code> is <code>undefined</code>.
103
104
* @param {JulianDate} [options.startTime] The scene time to start playing the animation. When this is <code>undefined</code>, the animation starts at the next frame.
104
105
* @param {Number} [options.delay=0.0] The delay, in seconds, from <code>startTime</code> to start playing.
105
106
* @param {JulianDate} [options.stopTime] The scene time to stop playing the animation. When this is <code>undefined</code>, the animation is played for its full duration.
@@ -111,16 +112,23 @@ define([
111
112
*
112
113
* @exception {DeveloperError} Animations are not loaded. Wait for the {@link Model#readyPromise} to resolve.
113
114
* @exception {DeveloperError} options.name must be a valid animation name.
115
+
* @exception {DeveloperError} options.index must be a valid animation index.
116
+
* @exception {DeveloperError} Either options.name or options.index must be defined.
114
117
* @exception {DeveloperError} options.speedup must be greater than zero.
115
118
*
116
119
* @example
117
-
* // Example 1. Add an animation
120
+
* // Example 1. Add an animation by name
118
121
* model.activeAnimations.add({
119
122
* name : 'animation name'
120
123
* });
121
124
*
125
+
* // Example 2. Add an animation by index
126
+
* model.activeAnimations.add({
127
+
* index : 0
128
+
* });
129
+
*
122
130
* @example
123
-
* // Example 2. Add an animation and provide all properties and events
131
+
* // Example 3. Add an animation and provide all properties and events
124
132
* var startTime = Cesium.JulianDate.now();
125
133
*
126
134
* var animation = model.activeAnimations.add({
@@ -154,14 +162,21 @@ define([
154
162
if(!defined(animations)){
155
163
thrownewDeveloperError('Animations are not loaded. Wait for Model.readyPromise to resolve.');
156
164
}
157
-
if(!defined(options.name)){
158
-
thrownewDeveloperError('options.name must be defined.');
0 commit comments