From 270938b5614e6b25875f070061af1cfa4242fc32 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 14:46:31 -0500 Subject: [PATCH 1/7] Deprecate speedup --- Source/Scene/Model.js | 2 +- Source/Scene/ModelAnimation.js | 37 +++++++++++++++++++++--- Source/Scene/ModelAnimationCollection.js | 37 ++++++++++++++++-------- 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 041179f01256..5a42decf7ac0 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -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({ - * speedup : 0.5 + * timeMultiplier : 0.5 * }); * }).otherwise(function(error){ * window.alert(error); diff --git a/Source/Scene/ModelAnimation.js b/Source/Scene/ModelAnimation.js index fef6d0b8bba6..8abcffeb05ca 100644 --- a/Source/Scene/ModelAnimation.js +++ b/Source/Scene/ModelAnimation.js @@ -1,6 +1,8 @@ define([ '../Core/defaultValue', '../Core/defineProperties', + '../Core/defined', + '../Core/deprecationWarning', '../Core/Event', '../Core/JulianDate', './ModelAnimationLoop', @@ -8,6 +10,8 @@ define([ ], function( defaultValue, defineProperties, + defined, + deprecationWarning, Event, JulianDate, ModelAnimationLoop, @@ -46,7 +50,12 @@ define([ */ this.removeOnStop = defaultValue(options.removeOnStop, false); - this._speedup = defaultValue(options.speedup, 1.0); + 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; + } + + this._timeMultiplier = defaultValue(options.timeMultiplier, 1.0); this._reverse = defaultValue(options.reverse, false); this._loop = defaultValue(options.loop, ModelAnimationLoop.NONE); @@ -189,24 +198,44 @@ define([ return this._stopTime; } }, - /** * Values greater than 1.0 increase the speed that the animation is played relative * to the scene clock speed; values less than 1.0 decrease the speed. A value of * 1.0 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 speedup is 1.0. + * will play in one second even if timeMultiplier is 1.0. + * + * @memberof ModelAnimation.prototype * + * @type {Number} + * @readonly + * + * @default 1.0 + */ + timeMultiplier : { + get : function() { + return this._timeMultiplier; + } + }, + + /** + * Values greater than 1.0 increase the speed that the animation is played relative + * to the scene clock speed; values less than 1.0 decrease the speed. A value of + * 1.0 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 timeMultiplier is 1.0. * @memberof ModelAnimation.prototype * * @type {Number} * @readonly + * @deprecated This property has been deprecated. Use {@link ModelAnimation#timeMultiplier} instead. * * @default 1.0 */ speedup : { get : function() { - return this._speedup; + deprecationWarning('ModelAnimation.speedup', 'ModelAnimation.speedup is deprecated and will be removed in Cesium 1.54. Use ModelAnimation.timeMultiplier instead.'); + return this._timeMultiplier; } }, diff --git a/Source/Scene/ModelAnimationCollection.js b/Source/Scene/ModelAnimationCollection.js index 9abadc4d64c5..5ecd0aa5bb45 100644 --- a/Source/Scene/ModelAnimationCollection.js +++ b/Source/Scene/ModelAnimationCollection.js @@ -2,6 +2,7 @@ define([ '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', + '../Core/deprecationWarning', '../Core/DeveloperError', '../Core/Event', '../Core/JulianDate', @@ -13,6 +14,7 @@ define([ defaultValue, defined, defineProperties, + deprecationWarning, DeveloperError, Event, JulianDate, @@ -104,7 +106,7 @@ define([ * @param {Number} [options.delay=0.0] The delay, in seconds, from startTime to start playing. * @param {JulianDate} [options.stopTime] The scene time to stop playing the animation. When this is undefined, the animation is played for its full duration. * @param {Boolean} [options.removeOnStop=false] When true, the animation is removed after it stops playing. - * @param {Number} [options.speedup=1.0] Values greater than 1.0 increase the speed that the animation is played relative to the scene clock speed; values less than 1.0 decrease the speed. + * @param {Number} [options.timeMultiplier=1.0] Values greater than 1.0 increase the speed that the animation is played relative to the scene clock speed; values less than 1.0 decrease the speed. * @param {Boolean} [options.reverse=false] When true, 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. @@ -113,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.speedup must be greater than zero. + * @exception {DeveloperError} options.timeMultiplier must be greater than zero. * * @example * // Example 1. Add an animation by name @@ -136,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) - * speedup : 2.0, // Play at double speed + * timeMultiplier : 2.0, // Play at double speed * reverse : true, // Play in reverse * loop : Cesium.ModelAnimationLoop.REPEAT // Loop the animation * }); @@ -164,8 +166,14 @@ define([ if (!defined(options.name) && !defined(options.index)) { throw new DeveloperError('Either options.name or options.index must be defined.'); } - if (defined(options.speedup) && (options.speedup <= 0.0)) { - throw new DeveloperError('options.speedup must be greater than zero.'); + + 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; + } + + if (defined(options.timeMultiplier) && (options.timeMultiplier <= 0.0)) { + throw new DeveloperError('options.timeMultiplier 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.'); @@ -207,17 +215,17 @@ define([ * @param {Number} [options.delay=0.0] The delay, in seconds, from startTime to start playing. * @param {JulianDate} [options.stopTime] The scene time to stop playing the animations. When this is undefined, the animations are played for its full duration. * @param {Boolean} [options.removeOnStop=false] When true, the animations are removed after they stop playing. - * @param {Number} [options.speedup=1.0] Values greater than 1.0 increase the speed that the animations play relative to the scene clock speed; values less than 1.0 decrease the speed. + * @param {Number} [options.timeMultiplier=1.0] Values greater than 1.0 increase the speed that the animations play relative to the scene clock speed; values less than 1.0 decrease the speed. * @param {Boolean} [options.reverse=false] When true, 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.speedup must be greater than zero. + * @exception {DeveloperError} options.timeMultiplier must be greater than zero. * * @example * model.activeAnimations.addAll({ - * speedup : 0.5, // Play at half-speed + * timeMultiplier : 0.5, // Play at half-speed * loop : Cesium.ModelAnimationLoop.REPEAT // Loop the animations * }); */ @@ -229,8 +237,13 @@ define([ throw new DeveloperError('Animations are not loaded. Wait for Model.readyPromise to resolve.'); } - if (defined(options.speedup) && (options.speedup <= 0.0)) { - throw new DeveloperError('options.speedup must be greater than zero.'); + 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; + } + + if (defined(options.timeMultiplier) && (options.timeMultiplier <= 0.0)) { + throw new DeveloperError('options.timeMultiplier must be greater than zero.'); } //>>includeEnd('debug'); @@ -385,7 +398,7 @@ define([ } if (!defined(scheduledAnimation._duration)) { - scheduledAnimation._duration = runtimeAnimation.stopTime * (1.0 / scheduledAnimation.speedup); + scheduledAnimation._duration = runtimeAnimation.stopTime * (1.0 / scheduledAnimation.timeMultiplier); } var startTime = scheduledAnimation._computedStartTime; @@ -431,7 +444,7 @@ define([ delta = 1.0 - delta; } - var localAnimationTime = delta * duration * scheduledAnimation.speedup; + var localAnimationTime = delta * duration * scheduledAnimation.timeMultiplier; // Clamp in case floating-point roundoff goes outside the animation's first or last keyframe localAnimationTime = CesiumMath.clamp(localAnimationTime, runtimeAnimation.startTime, runtimeAnimation.stopTime); From 2137f1579bbaa5177424319ed820a407f790859c Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 14:46:50 -0500 Subject: [PATCH 2/7] Tweak deprecated notice to add newline --- Tools/jsdoc/cesium_template/tmpl/details.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tools/jsdoc/cesium_template/tmpl/details.tmpl b/Tools/jsdoc/cesium_template/tmpl/details.tmpl index 613578419fdc..ab85859ae4b8 100644 --- a/Tools/jsdoc/cesium_template/tmpl/details.tmpl +++ b/Tools/jsdoc/cesium_template/tmpl/details.tmpl @@ -32,8 +32,10 @@ var self = this; - Deprecated: - +

+ Deprecated: + +

From 3f567cfb00cc65c41f9ca49a69dab8c1084215db Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 14:48:55 -0500 Subject: [PATCH 3/7] Update all sandcastle examples --- Apps/Sandcastle/gallery/HeadingPitchRoll.html | 2 +- Apps/Sandcastle/gallery/LocalToFixedFrame.html | 2 +- Apps/Sandcastle/gallery/development/3D Models Instancing.html | 4 ++-- Apps/Sandcastle/gallery/development/3D Models.html | 2 +- Apps/Sandcastle/gallery/development/Multiple Shadows.html | 2 +- Apps/Sandcastle/gallery/development/Shadows.html | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Apps/Sandcastle/gallery/HeadingPitchRoll.html b/Apps/Sandcastle/gallery/HeadingPitchRoll.html index abb0132f9df4..dae4fcf7e287 100644 --- a/Apps/Sandcastle/gallery/HeadingPitchRoll.html +++ b/Apps/Sandcastle/gallery/HeadingPitchRoll.html @@ -120,7 +120,7 @@

Loading...

planePrimitive.readyPromise.then(function(model) { // Play and loop all animations at half-speed model.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); diff --git a/Apps/Sandcastle/gallery/LocalToFixedFrame.html b/Apps/Sandcastle/gallery/LocalToFixedFrame.html index 0fc145270f67..0b2ffc63719b 100644 --- a/Apps/Sandcastle/gallery/LocalToFixedFrame.html +++ b/Apps/Sandcastle/gallery/LocalToFixedFrame.html @@ -142,7 +142,7 @@

Loading...

primitives[0].primitive.readyPromise.then(function(model) { // Play and loop all animations at half-speed model.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); diff --git a/Apps/Sandcastle/gallery/development/3D Models Instancing.html b/Apps/Sandcastle/gallery/development/3D Models Instancing.html index 716668680628..a82767d4b14b 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Instancing.html +++ b/Apps/Sandcastle/gallery/development/3D Models Instancing.html @@ -64,7 +64,7 @@ collection.readyPromise.then(function(collection) { // Play and loop all animations at half-speed collection.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); orientCamera(collection._boundingSphere.center, collection._boundingSphere.radius); @@ -93,7 +93,7 @@ model.readyPromise.then(function(model) { // Play and loop all animations at half-speed model.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); }).otherwise(function(error){ diff --git a/Apps/Sandcastle/gallery/development/3D Models.html b/Apps/Sandcastle/gallery/development/3D Models.html index 9facf1c0b47a..294a4629b932 100644 --- a/Apps/Sandcastle/gallery/development/3D Models.html +++ b/Apps/Sandcastle/gallery/development/3D Models.html @@ -145,7 +145,7 @@ model.colorBlendAmount = viewModel.colorBlendAmount; // Play and loop all animations at half-speed model.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); diff --git a/Apps/Sandcastle/gallery/development/Multiple Shadows.html b/Apps/Sandcastle/gallery/development/Multiple Shadows.html index 35bf6f7a7c8e..52961e2780df 100644 --- a/Apps/Sandcastle/gallery/development/Multiple Shadows.html +++ b/Apps/Sandcastle/gallery/development/Multiple Shadows.html @@ -76,7 +76,7 @@ model.readyPromise.then(function(model) { // Play and loop all animations at half-speed model.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); }).otherwise(function(error) { diff --git a/Apps/Sandcastle/gallery/development/Shadows.html b/Apps/Sandcastle/gallery/development/Shadows.html index 4b296c811d03..4d67e4e4d586 100644 --- a/Apps/Sandcastle/gallery/development/Shadows.html +++ b/Apps/Sandcastle/gallery/development/Shadows.html @@ -611,7 +611,7 @@ model.readyPromise.then(function(model) { // Play and loop all animations at half-speed model.activeAnimations.addAll({ - speedup : 0.5, + timeMultiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); }).otherwise(function(error){ From fb77b5e24537335b427975a16f63534bffc339db Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 14:58:36 -0500 Subject: [PATCH 4/7] Update specs --- Specs/Scene/ModelSpec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index f441a1a05d0f..2289a0193799 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -1300,10 +1300,10 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('addAll throws when speedup is less than or equal to zero.', function() { + it('addAll throws when timeMultiplier is less than or equal to zero.', function() { expect(function() { return animBoxesModel.activeAnimations.addAll({ - speedup : 0.0 + timeMultiplier : 0.0 }); }).toThrowDeveloperError(); }); @@ -1323,7 +1323,7 @@ defineSuite([ expect(a.delay).toEqual(0.0); expect(a.stopTime).not.toBeDefined(); expect(a.removeOnStop).toEqual(false); - expect(a.speedup).toEqual(1.0); + expect(a.timeMultiplier).toEqual(1.0); expect(a.reverse).toEqual(false); expect(a.loop).toEqual(ModelAnimationLoop.NONE); expect(a.start).toBeDefined(); @@ -1398,11 +1398,11 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('add throws when speedup is less than or equal to zero.', function() { + it('add throws when timeMultiplier is less than or equal to zero.', function() { expect(function() { return animBoxesModel.activeAnimations.add({ name : 'animation_1', - speedup : 0.0 + timeMultiplier : 0.0 }); }).toThrowDeveloperError(); }); @@ -1512,13 +1512,13 @@ defineSuite([ animBoxesModel.show = false; }); - it('Animates with a speedup', function() { + it('Animates with a timeMultiplier', 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, - speedup : 1.5 + timeMultiplier : 1.5 }); var spyUpdate = jasmine.createSpy('listener'); From d5dec685ebda42ebc9d6cce3540e802772978cdd Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 15:01:08 -0500 Subject: [PATCH 5/7] Add changes.md notice --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 33a24e094fee..d10418bba95a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,9 @@ Change Log ##### Breaking Changes :mega: * `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. [#????](https://github.com/AnalyticalGraphicsInc/cesium/pull/????) + ##### 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) * Added `Scene.sampleHeightMostDetailed`, an asynchronous version of `Scene.sampleHeight` that uses the maximum level of detail for 3D Tiles. From f53ae6f1b76c75667cdf5136d0ca8d1960033c70 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 15:09:48 -0500 Subject: [PATCH 6/7] Add PR link to CHANGES --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d10418bba95a..e57e2526b5bf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. [#????](https://github.com/AnalyticalGraphicsInc/cesium/pull/????) +* 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) ##### 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) From 1f24d80bca2e09008cfe5032a2c568eade990e71 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 6 Dec 2018 17:44:25 -0500 Subject: [PATCH 7/7] Rename timeMultiplier to multiplier --- Apps/Sandcastle/gallery/HeadingPitchRoll.html | 2 +- .../Sandcastle/gallery/LocalToFixedFrame.html | 2 +- .../development/3D Models Instancing.html | 4 +-- .../gallery/development/3D Models.html | 2 +- .../gallery/development/Multiple Shadows.html | 2 +- .../gallery/development/Shadows.html | 2 +- CHANGES.md | 2 +- Source/Scene/Model.js | 2 +- Source/Scene/ModelAnimation.js | 20 ++++++------ Source/Scene/ModelAnimationCollection.js | 32 +++++++++---------- Specs/Scene/ModelSpec.js | 14 ++++---- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Apps/Sandcastle/gallery/HeadingPitchRoll.html b/Apps/Sandcastle/gallery/HeadingPitchRoll.html index dae4fcf7e287..b681a057d984 100644 --- a/Apps/Sandcastle/gallery/HeadingPitchRoll.html +++ b/Apps/Sandcastle/gallery/HeadingPitchRoll.html @@ -120,7 +120,7 @@

Loading...

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 }); diff --git a/Apps/Sandcastle/gallery/LocalToFixedFrame.html b/Apps/Sandcastle/gallery/LocalToFixedFrame.html index 0b2ffc63719b..5970d3f693ff 100644 --- a/Apps/Sandcastle/gallery/LocalToFixedFrame.html +++ b/Apps/Sandcastle/gallery/LocalToFixedFrame.html @@ -142,7 +142,7 @@

Loading...

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 }); diff --git a/Apps/Sandcastle/gallery/development/3D Models Instancing.html b/Apps/Sandcastle/gallery/development/3D Models Instancing.html index a82767d4b14b..2ed6f09a88f2 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Instancing.html +++ b/Apps/Sandcastle/gallery/development/3D Models Instancing.html @@ -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); @@ -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){ diff --git a/Apps/Sandcastle/gallery/development/3D Models.html b/Apps/Sandcastle/gallery/development/3D Models.html index 294a4629b932..ae8298ae3104 100644 --- a/Apps/Sandcastle/gallery/development/3D Models.html +++ b/Apps/Sandcastle/gallery/development/3D Models.html @@ -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 }); diff --git a/Apps/Sandcastle/gallery/development/Multiple Shadows.html b/Apps/Sandcastle/gallery/development/Multiple Shadows.html index 52961e2780df..98d4f0ef3576 100644 --- a/Apps/Sandcastle/gallery/development/Multiple Shadows.html +++ b/Apps/Sandcastle/gallery/development/Multiple Shadows.html @@ -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) { diff --git a/Apps/Sandcastle/gallery/development/Shadows.html b/Apps/Sandcastle/gallery/development/Shadows.html index 4d67e4e4d586..bae91b3b7c49 100644 --- a/Apps/Sandcastle/gallery/development/Shadows.html +++ b/Apps/Sandcastle/gallery/development/Shadows.html @@ -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){ diff --git a/CHANGES.md b/CHANGES.md index e6989b899823..74362f54e877 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 5a42decf7ac0..48d37eb915c5 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -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); diff --git a/Source/Scene/ModelAnimation.js b/Source/Scene/ModelAnimation.js index 8abcffeb05ca..478525ef7792 100644 --- a/Source/Scene/ModelAnimation.js +++ b/Source/Scene/ModelAnimation.js @@ -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); @@ -203,7 +203,7 @@ define([ * to the scene clock speed; values less than 1.0 decrease the speed. A value of * 1.0 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 timeMultiplier is 1.0. + * will play in one second even if multiplier is 1.0. * * @memberof ModelAnimation.prototype * @@ -212,9 +212,9 @@ define([ * * @default 1.0 */ - timeMultiplier : { + multiplier : { get : function() { - return this._timeMultiplier; + return this._multiplier; } }, @@ -223,19 +223,19 @@ define([ * to the scene clock speed; values less than 1.0 decrease the speed. A value of * 1.0 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 timeMultiplier is 1.0. + * will play in one second even if multiplier is 1.0. * @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; } }, diff --git a/Source/Scene/ModelAnimationCollection.js b/Source/Scene/ModelAnimationCollection.js index 832ae8fea613..4a484bc3d537 100644 --- a/Source/Scene/ModelAnimationCollection.js +++ b/Source/Scene/ModelAnimationCollection.js @@ -106,7 +106,7 @@ define([ * @param {Number} [options.delay=0.0] The delay, in seconds, from startTime to start playing. * @param {JulianDate} [options.stopTime] The scene time to stop playing the animation. When this is undefined, the animation is played for its full duration. * @param {Boolean} [options.removeOnStop=false] When true, the animation is removed after it stops playing. - * @param {Number} [options.timeMultiplier=1.0] Values greater than 1.0 increase the speed that the animation is played relative to the scene clock speed; values less than 1.0 decrease the speed. + * @param {Number} [options.multiplier=1.0] Values greater than 1.0 increase the speed that the animation is played relative to the scene clock speed; values less than 1.0 decrease the speed. * @param {Boolean} [options.reverse=false] When true, 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. @@ -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 @@ -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 * }); @@ -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.'); @@ -215,17 +215,17 @@ define([ * @param {Number} [options.delay=0.0] The delay, in seconds, from startTime to start playing. * @param {JulianDate} [options.stopTime] The scene time to stop playing the animations. When this is undefined, the animations are played for its full duration. * @param {Boolean} [options.removeOnStop=false] When true, the animations are removed after they stop playing. - * @param {Number} [options.timeMultiplier=1.0] Values greater than 1.0 increase the speed that the animations play relative to the scene clock speed; values less than 1.0 decrease the speed. + * @param {Number} [options.multiplier=1.0] Values greater than 1.0 increase the speed that the animations play relative to the scene clock speed; values less than 1.0 decrease the speed. * @param {Boolean} [options.reverse=false] When true, 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 * }); */ @@ -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'); @@ -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; @@ -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); diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index 2289a0193799..2d50cd0887b9 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -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(); }); @@ -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(); @@ -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(); }); @@ -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');