Skip to content

Commit 47deb4c

Browse files
authored
Merge pull request #7393 from OmarShehata/deprecate-speedup
Rename speedup to multiplier
2 parents f643557 + 1f24d80 commit 47deb4c

12 files changed

+80
-33
lines changed

Apps/Sandcastle/gallery/HeadingPitchRoll.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ <h1>Loading...</h1>
120120
planePrimitive.readyPromise.then(function(model) {
121121
// Play and loop all animations at half-speed
122122
model.activeAnimations.addAll({
123-
speedup : 0.5,
123+
multiplier : 0.5,
124124
loop : Cesium.ModelAnimationLoop.REPEAT
125125
});
126126

Apps/Sandcastle/gallery/LocalToFixedFrame.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ <h1>Loading...</h1>
142142
primitives[0].primitive.readyPromise.then(function(model) {
143143
// Play and loop all animations at half-speed
144144
model.activeAnimations.addAll({
145-
speedup : 0.5,
145+
multiplier : 0.5,
146146
loop : Cesium.ModelAnimationLoop.REPEAT
147147
});
148148

Apps/Sandcastle/gallery/development/3D Models Instancing.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
collection.readyPromise.then(function(collection) {
6565
// Play and loop all animations at half-speed
6666
collection.activeAnimations.addAll({
67-
speedup : 0.5,
67+
multiplier : 0.5,
6868
loop : Cesium.ModelAnimationLoop.REPEAT
6969
});
7070
orientCamera(collection._boundingSphere.center, collection._boundingSphere.radius);
@@ -93,7 +93,7 @@
9393
model.readyPromise.then(function(model) {
9494
// Play and loop all animations at half-speed
9595
model.activeAnimations.addAll({
96-
speedup : 0.5,
96+
multiplier : 0.5,
9797
loop : Cesium.ModelAnimationLoop.REPEAT
9898
});
9999
}).otherwise(function(error){

Apps/Sandcastle/gallery/development/3D Models.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
model.colorBlendAmount = viewModel.colorBlendAmount;
146146
// Play and loop all animations at half-speed
147147
model.activeAnimations.addAll({
148-
speedup : 0.5,
148+
multiplier : 0.5,
149149
loop : Cesium.ModelAnimationLoop.REPEAT
150150
});
151151

Apps/Sandcastle/gallery/development/Multiple Shadows.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
model.readyPromise.then(function(model) {
7777
// Play and loop all animations at half-speed
7878
model.activeAnimations.addAll({
79-
speedup : 0.5,
79+
multiplier : 0.5,
8080
loop : Cesium.ModelAnimationLoop.REPEAT
8181
});
8282
}).otherwise(function(error) {

Apps/Sandcastle/gallery/development/Shadows.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@
611611
model.readyPromise.then(function(model) {
612612
// Play and loop all animations at half-speed
613613
model.activeAnimations.addAll({
614-
speedup : 0.5,
614+
multiplier : 0.5,
615615
loop : Cesium.ModelAnimationLoop.REPEAT
616616
});
617617
}).otherwise(function(error){

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Change Log
66
##### Breaking Changes :mega:
77
* `TerrainProviders` that implement `availability` must now also implement the `loadTileDataAvailability` method.
88

9+
##### Deprecated :hourglass_flowing_sand:
10+
* The property `ModelAnimation.speedup` has been deprecated and renamed to `ModelAnimation.multiplier`. `speedup` will be removed in version 1.54. [#7393](https://github.com/AnalyticalGraphicsInc/cesium/pull/7393)
11+
912
##### Additions :tada:
1013
* Added functions to get the most detailed height of 3D Tiles on-screen or off-screen. [#7115](https://github.com/AnalyticalGraphicsInc/cesium/pull/7115)
1114
* Added `Scene.sampleHeightMostDetailed`, an asynchronous version of `Scene.sampleHeight` that uses the maximum level of detail for 3D Tiles.

Source/Scene/Model.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ define([
833833
* // Play all animations at half-speed when the model is ready to render
834834
* Cesium.when(model.readyPromise).then(function(model) {
835835
* model.activeAnimations.addAll({
836-
* speedup : 0.5
836+
* multiplier : 0.5
837837
* });
838838
* }).otherwise(function(error){
839839
* window.alert(error);

Source/Scene/ModelAnimation.js

+33-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
define([
22
'../Core/defaultValue',
33
'../Core/defineProperties',
4+
'../Core/defined',
5+
'../Core/deprecationWarning',
46
'../Core/Event',
57
'../Core/JulianDate',
68
'./ModelAnimationLoop',
79
'./ModelAnimationState'
810
], function(
911
defaultValue,
1012
defineProperties,
13+
defined,
14+
deprecationWarning,
1115
Event,
1216
JulianDate,
1317
ModelAnimationLoop,
@@ -46,7 +50,12 @@ define([
4650
*/
4751
this.removeOnStop = defaultValue(options.removeOnStop, false);
4852

49-
this._speedup = defaultValue(options.speedup, 1.0);
53+
if (defined(options.speedup)) {
54+
deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.multiplier instead.');
55+
options.multiplier = options.speedup;
56+
}
57+
58+
this._multiplier = defaultValue(options.multiplier, 1.0);
5059
this._reverse = defaultValue(options.reverse, false);
5160
this._loop = defaultValue(options.loop, ModelAnimationLoop.NONE);
5261

@@ -189,24 +198,44 @@ define([
189198
return this._stopTime;
190199
}
191200
},
192-
193201
/**
194202
* Values greater than <code>1.0</code> increase the speed that the animation is played relative
195203
* to the scene clock speed; values less than <code>1.0</code> decrease the speed. A value of
196204
* <code>1.0</code> plays the animation at the speed in the glTF animation mapped to the scene
197205
* clock speed. For example, if the scene is played at 2x real-time, a two-second glTF animation
198-
* will play in one second even if <code>speedup</code> is <code>1.0</code>.
206+
* will play in one second even if <code>multiplier</code> is <code>1.0</code>.
207+
*
208+
* @memberof ModelAnimation.prototype
199209
*
210+
* @type {Number}
211+
* @readonly
212+
*
213+
* @default 1.0
214+
*/
215+
multiplier : {
216+
get : function() {
217+
return this._multiplier;
218+
}
219+
},
220+
221+
/**
222+
* Values greater than <code>1.0</code> increase the speed that the animation is played relative
223+
* to the scene clock speed; values less than <code>1.0</code> decrease the speed. A value of
224+
* <code>1.0</code> plays the animation at the speed in the glTF animation mapped to the scene
225+
* clock speed. For example, if the scene is played at 2x real-time, a two-second glTF animation
226+
* will play in one second even if <code>multiplier</code> is <code>1.0</code>.
200227
* @memberof ModelAnimation.prototype
201228
*
202229
* @type {Number}
203230
* @readonly
231+
* @deprecated This property has been deprecated. Use {@link ModelAnimation#multiplier} instead.
204232
*
205233
* @default 1.0
206234
*/
207235
speedup : {
208236
get : function() {
209-
return this._speedup;
237+
deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.multiplier instead.');
238+
return this._multiplier;
210239
}
211240
},
212241

Source/Scene/ModelAnimationCollection.js

+25-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ define([
22
'../Core/defaultValue',
33
'../Core/defined',
44
'../Core/defineProperties',
5+
'../Core/deprecationWarning',
56
'../Core/DeveloperError',
67
'../Core/Event',
78
'../Core/JulianDate',
@@ -13,6 +14,7 @@ define([
1314
defaultValue,
1415
defined,
1516
defineProperties,
17+
deprecationWarning,
1618
DeveloperError,
1719
Event,
1820
JulianDate,
@@ -104,7 +106,7 @@ define([
104106
* @param {Number} [options.delay=0.0] The delay, in seconds, from <code>startTime</code> to start playing.
105107
* @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.
106108
* @param {Boolean} [options.removeOnStop=false] When <code>true</code>, the animation is removed after it stops playing.
107-
* @param {Number} [options.speedup=1.0] Values greater than <code>1.0</code> increase the speed that the animation is played relative to the scene clock speed; values less than <code>1.0</code> decrease the speed.
109+
* @param {Number} [options.multiplier=1.0] Values greater than <code>1.0</code> increase the speed that the animation is played relative to the scene clock speed; values less than <code>1.0</code> decrease the speed.
108110
* @param {Boolean} [options.reverse=false] When <code>true</code>, the animation is played in reverse.
109111
* @param {ModelAnimationLoop} [options.loop=ModelAnimationLoop.NONE] Determines if and how the animation is looped.
110112
* @returns {ModelAnimation} The animation that was added to the collection.
@@ -113,7 +115,7 @@ define([
113115
* @exception {DeveloperError} options.name must be a valid animation name.
114116
* @exception {DeveloperError} options.index must be a valid animation index.
115117
* @exception {DeveloperError} Either options.name or options.index must be defined.
116-
* @exception {DeveloperError} options.speedup must be greater than zero.
118+
* @exception {DeveloperError} options.multiplier must be greater than zero.
117119
*
118120
* @example
119121
* // Example 1. Add an animation by name
@@ -136,7 +138,7 @@ define([
136138
* delay : 0.0, // Play at startTime (default)
137139
* stopTime : Cesium.JulianDate.addSeconds(startTime, 4.0, new Cesium.JulianDate()),
138140
* removeOnStop : false, // Do not remove when animation stops (default)
139-
* speedup : 2.0, // Play at double speed
141+
* multiplier : 2.0, // Play at double speed
140142
* reverse : true, // Play in reverse
141143
* loop : Cesium.ModelAnimationLoop.REPEAT // Loop the animation
142144
* });
@@ -164,8 +166,14 @@ define([
164166
if (!defined(options.name) && !defined(options.index)) {
165167
throw new DeveloperError('Either options.name or options.index must be defined.');
166168
}
167-
if (defined(options.speedup) && (options.speedup <= 0.0)) {
168-
throw new DeveloperError('options.speedup must be greater than zero.');
169+
170+
if (defined(options.speedup)) {
171+
deprecationWarning('options.speedup', 'options.speedup is deprecated and will be removed in Cesium 1.54. Use options.multiplier instead.');
172+
options.multiplier = options.speedup;
173+
}
174+
175+
if (defined(options.multiplier) && (options.multiplier <= 0.0)) {
176+
throw new DeveloperError('options.multiplier must be greater than zero.');
169177
}
170178
if (defined(options.index) && (options.index >= animations.length || options.index < 0)) {
171179
throw new DeveloperError('options.index must be a valid animation index.');
@@ -207,17 +215,17 @@ define([
207215
* @param {Number} [options.delay=0.0] The delay, in seconds, from <code>startTime</code> to start playing.
208216
* @param {JulianDate} [options.stopTime] The scene time to stop playing the animations. When this is <code>undefined</code>, the animations are played for its full duration.
209217
* @param {Boolean} [options.removeOnStop=false] When <code>true</code>, the animations are removed after they stop playing.
210-
* @param {Number} [options.speedup=1.0] Values greater than <code>1.0</code> increase the speed that the animations play relative to the scene clock speed; values less than <code>1.0</code> decrease the speed.
218+
* @param {Number} [options.multiplier=1.0] Values greater than <code>1.0</code> increase the speed that the animations play relative to the scene clock speed; values less than <code>1.0</code> decrease the speed.
211219
* @param {Boolean} [options.reverse=false] When <code>true</code>, the animations are played in reverse.
212220
* @param {ModelAnimationLoop} [options.loop=ModelAnimationLoop.NONE] Determines if and how the animations are looped.
213221
* @returns {ModelAnimation[]} An array of {@link ModelAnimation} objects, one for each animation added to the collection. If there are no glTF animations, the array is empty.
214222
*
215223
* @exception {DeveloperError} Animations are not loaded. Wait for the {@link Model#readyPromise} to resolve.
216-
* @exception {DeveloperError} options.speedup must be greater than zero.
224+
* @exception {DeveloperError} options.multiplier must be greater than zero.
217225
*
218226
* @example
219227
* model.activeAnimations.addAll({
220-
* speedup : 0.5, // Play at half-speed
228+
* multiplier : 0.5, // Play at half-speed
221229
* loop : Cesium.ModelAnimationLoop.REPEAT // Loop the animations
222230
* });
223231
*/
@@ -229,8 +237,13 @@ define([
229237
throw new DeveloperError('Animations are not loaded. Wait for Model.readyPromise to resolve.');
230238
}
231239

232-
if (defined(options.speedup) && (options.speedup <= 0.0)) {
233-
throw new DeveloperError('options.speedup must be greater than zero.');
240+
if (defined(options.speedup)) {
241+
deprecationWarning('options.speedup', 'options.speedup is deprecated and will be removed in Cesium 1.54. Use options.multiplier instead.');
242+
options.multiplier = options.speedup;
243+
}
244+
245+
if (defined(options.multiplier) && (options.multiplier <= 0.0)) {
246+
throw new DeveloperError('options.multiplier must be greater than zero.');
234247
}
235248
//>>includeEnd('debug');
236249

@@ -385,7 +398,7 @@ define([
385398
}
386399

387400
if (!defined(scheduledAnimation._duration)) {
388-
scheduledAnimation._duration = runtimeAnimation.stopTime * (1.0 / scheduledAnimation.speedup);
401+
scheduledAnimation._duration = runtimeAnimation.stopTime * (1.0 / scheduledAnimation.multiplier);
389402
}
390403

391404
var startTime = scheduledAnimation._computedStartTime;
@@ -431,7 +444,7 @@ define([
431444
delta = 1.0 - delta;
432445
}
433446

434-
var localAnimationTime = delta * duration * scheduledAnimation.speedup;
447+
var localAnimationTime = delta * duration * scheduledAnimation.multiplier;
435448
// Clamp in case floating-point roundoff goes outside the animation's first or last keyframe
436449
localAnimationTime = CesiumMath.clamp(localAnimationTime, runtimeAnimation.startTime, runtimeAnimation.stopTime);
437450

Specs/Scene/ModelSpec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1300,10 +1300,10 @@ defineSuite([
13001300
}).toThrowDeveloperError();
13011301
});
13021302

1303-
it('addAll throws when speedup is less than or equal to zero.', function() {
1303+
it('addAll throws when multiplier is less than or equal to zero.', function() {
13041304
expect(function() {
13051305
return animBoxesModel.activeAnimations.addAll({
1306-
speedup : 0.0
1306+
multiplier : 0.0
13071307
});
13081308
}).toThrowDeveloperError();
13091309
});
@@ -1323,7 +1323,7 @@ defineSuite([
13231323
expect(a.delay).toEqual(0.0);
13241324
expect(a.stopTime).not.toBeDefined();
13251325
expect(a.removeOnStop).toEqual(false);
1326-
expect(a.speedup).toEqual(1.0);
1326+
expect(a.multiplier).toEqual(1.0);
13271327
expect(a.reverse).toEqual(false);
13281328
expect(a.loop).toEqual(ModelAnimationLoop.NONE);
13291329
expect(a.start).toBeDefined();
@@ -1398,11 +1398,11 @@ defineSuite([
13981398
}).toThrowDeveloperError();
13991399
});
14001400

1401-
it('add throws when speedup is less than or equal to zero.', function() {
1401+
it('add throws when multiplier is less than or equal to zero.', function() {
14021402
expect(function() {
14031403
return animBoxesModel.activeAnimations.add({
14041404
name : 'animation_1',
1405-
speedup : 0.0
1405+
multiplier : 0.0
14061406
});
14071407
}).toThrowDeveloperError();
14081408
});
@@ -1512,13 +1512,13 @@ defineSuite([
15121512
animBoxesModel.show = false;
15131513
});
15141514

1515-
it('Animates with a speedup', function() {
1515+
it('Animates with a multiplier', function() {
15161516
var time = JulianDate.fromDate(new Date('January 1, 2014 12:00:00 UTC'));
15171517
var animations = animBoxesModel.activeAnimations;
15181518
var a = animations.add({
15191519
name : 'animation_1',
15201520
startTime : time,
1521-
speedup : 1.5
1521+
multiplier : 1.5
15221522
});
15231523

15241524
var spyUpdate = jasmine.createSpy('listener');

Tools/jsdoc/cesium_template/tmpl/details.tmpl

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ var self = this;
3232
<?js } ?>
3333

3434
<?js if (data.deprecated) { ?>
35-
<span class="details-header important">Deprecated:</span>
36-
<span><?js= data.deprecated ?></span>
35+
<p>
36+
<span class="details-header important">Deprecated:</span>
37+
<span><?js= data.deprecated ?></span>
38+
</p>
3739
<?js } ?>
3840

3941
<?js if (data.author && author.length) {?>

0 commit comments

Comments
 (0)