Skip to content

Commit

Permalink
Rename timeMultiplier to multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarShehata committed Dec 6, 2018
1 parent db0cb18 commit 1f24d80
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/HeadingPitchRoll.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h1>Loading...</h1>
planePrimitive.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});

Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/LocalToFixedFrame.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h1>Loading...</h1>
primitives[0].primitive.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});

Expand Down
4 changes: 2 additions & 2 deletions Apps/Sandcastle/gallery/development/3D Models Instancing.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
collection.readyPromise.then(function(collection) {
// Play and loop all animations at half-speed
collection.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});
orientCamera(collection._boundingSphere.center, collection._boundingSphere.radius);
Expand Down Expand Up @@ -93,7 +93,7 @@
model.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});
}).otherwise(function(error){
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/development/3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
model.colorBlendAmount = viewModel.colorBlendAmount;
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});

Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/development/Multiple Shadows.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
model.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});
}).otherwise(function(error) {
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/development/Shadows.html
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@
model.readyPromise.then(function(model) {
// Play and loop all animations at half-speed
model.activeAnimations.addAll({
timeMultiplier : 0.5,
multiplier : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});
}).otherwise(function(error){
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Change Log
* `TerrainProviders` that implement `availability` must now also implement the `loadTileDataAvailability` method.

##### Deprecated :hourglass_flowing_sand:
* The property `ModelAnimation.speedup` has been deprecated and renamed to `ModelAnimation.timeMultiplier`. `speedup` will be removed in version 1.54. [#7393](https://github.com/AnalyticalGraphicsInc/cesium/pull/7393)
* 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)

##### Additions :tada:
* Added functions to get the most detailed height of 3D Tiles on-screen or off-screen. [#7115](https://github.com/AnalyticalGraphicsInc/cesium/pull/7115)
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ define([
* // Play all animations at half-speed when the model is ready to render
* Cesium.when(model.readyPromise).then(function(model) {
* model.activeAnimations.addAll({
* timeMultiplier : 0.5
* multiplier : 0.5
* });
* }).otherwise(function(error){
* window.alert(error);
Expand Down
20 changes: 10 additions & 10 deletions Source/Scene/ModelAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ define([
this.removeOnStop = defaultValue(options.removeOnStop, false);

if (defined(options.speedup)) {
deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.timeMultiplier instead.');
options.timeMultiplier = options.speedup;
deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.multiplier instead.');
options.multiplier = options.speedup;
}

this._timeMultiplier = defaultValue(options.timeMultiplier, 1.0);
this._multiplier = defaultValue(options.multiplier, 1.0);
this._reverse = defaultValue(options.reverse, false);
this._loop = defaultValue(options.loop, ModelAnimationLoop.NONE);

Expand Down Expand Up @@ -203,7 +203,7 @@ define([
* to the scene clock speed; values less than <code>1.0</code> decrease the speed. A value of
* <code>1.0</code> plays the animation at the speed in the glTF animation mapped to the scene
* clock speed. For example, if the scene is played at 2x real-time, a two-second glTF animation
* will play in one second even if <code>timeMultiplier</code> is <code>1.0</code>.
* will play in one second even if <code>multiplier</code> is <code>1.0</code>.
*
* @memberof ModelAnimation.prototype
*
Expand All @@ -212,9 +212,9 @@ define([
*
* @default 1.0
*/
timeMultiplier : {
multiplier : {
get : function() {
return this._timeMultiplier;
return this._multiplier;
}
},

Expand All @@ -223,19 +223,19 @@ define([
* to the scene clock speed; values less than <code>1.0</code> decrease the speed. A value of
* <code>1.0</code> plays the animation at the speed in the glTF animation mapped to the scene
* clock speed. For example, if the scene is played at 2x real-time, a two-second glTF animation
* will play in one second even if <code>timeMultiplier</code> is <code>1.0</code>.
* will play in one second even if <code>multiplier</code> is <code>1.0</code>.
* @memberof ModelAnimation.prototype
*
* @type {Number}
* @readonly
* @deprecated This property has been deprecated. Use {@link ModelAnimation#timeMultiplier} instead.
* @deprecated This property has been deprecated. Use {@link ModelAnimation#multiplier} instead.
*
* @default 1.0
*/
speedup : {
get : function() {
deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.timeMultiplier instead.');
return this._timeMultiplier;
deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.multiplier instead.');
return this._multiplier;
}
},

Expand Down
32 changes: 16 additions & 16 deletions Source/Scene/ModelAnimationCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ define([
* @param {Number} [options.delay=0.0] The delay, in seconds, from <code>startTime</code> to start playing.
* @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.
* @param {Boolean} [options.removeOnStop=false] When <code>true</code>, the animation is removed after it stops playing.
* @param {Number} [options.timeMultiplier=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.
* @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.
* @param {Boolean} [options.reverse=false] When <code>true</code>, the animation is played in reverse.
* @param {ModelAnimationLoop} [options.loop=ModelAnimationLoop.NONE] Determines if and how the animation is looped.
* @returns {ModelAnimation} The animation that was added to the collection.
Expand All @@ -115,7 +115,7 @@ define([
* @exception {DeveloperError} options.name must be a valid animation name.
* @exception {DeveloperError} options.index must be a valid animation index.
* @exception {DeveloperError} Either options.name or options.index must be defined.
* @exception {DeveloperError} options.timeMultiplier must be greater than zero.
* @exception {DeveloperError} options.multiplier must be greater than zero.
*
* @example
* // Example 1. Add an animation by name
Expand All @@ -138,7 +138,7 @@ define([
* delay : 0.0, // Play at startTime (default)
* stopTime : Cesium.JulianDate.addSeconds(startTime, 4.0, new Cesium.JulianDate()),
* removeOnStop : false, // Do not remove when animation stops (default)
* timeMultiplier : 2.0, // Play at double speed
* multiplier : 2.0, // Play at double speed
* reverse : true, // Play in reverse
* loop : Cesium.ModelAnimationLoop.REPEAT // Loop the animation
* });
Expand Down Expand Up @@ -168,12 +168,12 @@ define([
}

if (defined(options.speedup)) {
deprecationWarning('options.speedup', 'options.speedup is deprecated and will be removed in Cesium 1.54. Use options.timeMultiplier instead.');
options.timeMultiplier = options.speedup;
deprecationWarning('options.speedup', 'options.speedup is deprecated and will be removed in Cesium 1.54. Use options.multiplier instead.');
options.multiplier = options.speedup;
}

if (defined(options.timeMultiplier) && (options.timeMultiplier <= 0.0)) {
throw new DeveloperError('options.timeMultiplier must be greater than zero.');
if (defined(options.multiplier) && (options.multiplier <= 0.0)) {
throw new DeveloperError('options.multiplier must be greater than zero.');
}
if (defined(options.index) && (options.index >= animations.length || options.index < 0)) {
throw new DeveloperError('options.index must be a valid animation index.');
Expand Down Expand Up @@ -215,17 +215,17 @@ define([
* @param {Number} [options.delay=0.0] The delay, in seconds, from <code>startTime</code> to start playing.
* @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.
* @param {Boolean} [options.removeOnStop=false] When <code>true</code>, the animations are removed after they stop playing.
* @param {Number} [options.timeMultiplier=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.
* @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.
* @param {Boolean} [options.reverse=false] When <code>true</code>, the animations are played in reverse.
* @param {ModelAnimationLoop} [options.loop=ModelAnimationLoop.NONE] Determines if and how the animations are looped.
* @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.
*
* @exception {DeveloperError} Animations are not loaded. Wait for the {@link Model#readyPromise} to resolve.
* @exception {DeveloperError} options.timeMultiplier must be greater than zero.
* @exception {DeveloperError} options.multiplier must be greater than zero.
*
* @example
* model.activeAnimations.addAll({
* timeMultiplier : 0.5, // Play at half-speed
* multiplier : 0.5, // Play at half-speed
* loop : Cesium.ModelAnimationLoop.REPEAT // Loop the animations
* });
*/
Expand All @@ -238,12 +238,12 @@ define([
}

if (defined(options.speedup)) {
deprecationWarning('options.speedup', 'options.speedup is deprecated and will be removed in Cesium 1.54. Use options.timeMultiplier instead.');
options.timeMultiplier = options.speedup;
deprecationWarning('options.speedup', 'options.speedup is deprecated and will be removed in Cesium 1.54. Use options.multiplier instead.');
options.multiplier = options.speedup;
}

if (defined(options.timeMultiplier) && (options.timeMultiplier <= 0.0)) {
throw new DeveloperError('options.timeMultiplier must be greater than zero.');
if (defined(options.multiplier) && (options.multiplier <= 0.0)) {
throw new DeveloperError('options.multiplier must be greater than zero.');
}
//>>includeEnd('debug');

Expand Down Expand Up @@ -398,7 +398,7 @@ define([
}

if (!defined(scheduledAnimation._duration)) {
scheduledAnimation._duration = runtimeAnimation.stopTime * (1.0 / scheduledAnimation.timeMultiplier);
scheduledAnimation._duration = runtimeAnimation.stopTime * (1.0 / scheduledAnimation.multiplier);
}

var startTime = scheduledAnimation._computedStartTime;
Expand Down Expand Up @@ -444,7 +444,7 @@ define([
delta = 1.0 - delta;
}

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

Expand Down
14 changes: 7 additions & 7 deletions Specs/Scene/ModelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1300,10 +1300,10 @@ defineSuite([
}).toThrowDeveloperError();
});

it('addAll throws when timeMultiplier is less than or equal to zero.', function() {
it('addAll throws when multiplier is less than or equal to zero.', function() {
expect(function() {
return animBoxesModel.activeAnimations.addAll({
timeMultiplier : 0.0
multiplier : 0.0
});
}).toThrowDeveloperError();
});
Expand All @@ -1323,7 +1323,7 @@ defineSuite([
expect(a.delay).toEqual(0.0);
expect(a.stopTime).not.toBeDefined();
expect(a.removeOnStop).toEqual(false);
expect(a.timeMultiplier).toEqual(1.0);
expect(a.multiplier).toEqual(1.0);
expect(a.reverse).toEqual(false);
expect(a.loop).toEqual(ModelAnimationLoop.NONE);
expect(a.start).toBeDefined();
Expand Down Expand Up @@ -1398,11 +1398,11 @@ defineSuite([
}).toThrowDeveloperError();
});

it('add throws when timeMultiplier is less than or equal to zero.', function() {
it('add throws when multiplier is less than or equal to zero.', function() {
expect(function() {
return animBoxesModel.activeAnimations.add({
name : 'animation_1',
timeMultiplier : 0.0
multiplier : 0.0
});
}).toThrowDeveloperError();
});
Expand Down Expand Up @@ -1512,13 +1512,13 @@ defineSuite([
animBoxesModel.show = false;
});

it('Animates with a timeMultiplier', function() {
it('Animates with a multiplier', function() {
var time = JulianDate.fromDate(new Date('January 1, 2014 12:00:00 UTC'));
var animations = animBoxesModel.activeAnimations;
var a = animations.add({
name : 'animation_1',
startTime : time,
timeMultiplier : 1.5
multiplier : 1.5
});

var spyUpdate = jasmine.createSpy('listener');
Expand Down

0 comments on commit 1f24d80

Please sign in to comment.