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
+19-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,22 @@ 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.
114
116
* @exception {DeveloperError} options.speedup must be greater than zero.
115
117
*
116
118
* @example
117
-
* // Example 1. Add an animation
119
+
* // Example 1. Add an animation by name
118
120
* model.activeAnimations.add({
119
121
* name : 'animation name'
120
122
* });
121
123
*
124
+
* // Example 2. Add an animation by index
125
+
* model.activeAnimations.add({
126
+
* index : 0
127
+
* });
128
+
*
122
129
* @example
123
-
* // Example 2. Add an animation and provide all properties and events
130
+
* // Example 3. Add an animation and provide all properties and events
124
131
* var startTime = Cesium.JulianDate.now();
125
132
*
126
133
* var animation = model.activeAnimations.add({
@@ -154,14 +161,21 @@ define([
154
161
if(!defined(animations)){
155
162
thrownewDeveloperError('Animations are not loaded. Wait for Model.readyPromise to resolve.');
156
163
}
157
-
if(!defined(options.name)){
158
-
thrownewDeveloperError('options.name must be defined.');
0 commit comments