diff --git a/Apps/Sandcastle/gallery/HeadingPitchRoll.html b/Apps/Sandcastle/gallery/HeadingPitchRoll.html index abb0132f9df4..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({ - speedup : 0.5, + multiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); diff --git a/Apps/Sandcastle/gallery/LocalToFixedFrame.html b/Apps/Sandcastle/gallery/LocalToFixedFrame.html index 0fc145270f67..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({ - speedup : 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 716668680628..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({ - speedup : 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({ - speedup : 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 9facf1c0b47a..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({ - speedup : 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 35bf6f7a7c8e..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({ - speedup : 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 4b296c811d03..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({ - speedup : 0.5, + multiplier : 0.5, loop : Cesium.ModelAnimationLoop.REPEAT }); }).otherwise(function(error){ diff --git a/CHANGES.md b/CHANGES.md index 198f1790503e..74362f54e877 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.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) * Added `Scene.sampleHeightMostDetailed`, an asynchronous version of `Scene.sampleHeight` that uses the maximum level of detail for 3D Tiles. diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 041179f01256..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({ - * speedup : 0.5 + * multiplier : 0.5 * }); * }).otherwise(function(error){ * window.alert(error); diff --git a/Source/Scene/ModelAnimation.js b/Source/Scene/ModelAnimation.js index fef6d0b8bba6..478525ef7792 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.multiplier instead.'); + options.multiplier = options.speedup; + } + + this._multiplier = defaultValue(options.multiplier, 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 multiplier is 1.0. + * + * @memberof ModelAnimation.prototype * + * @type {Number} + * @readonly + * + * @default 1.0 + */ + multiplier : { + get : function() { + return this._multiplier; + } + }, + + /** + * 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 multiplier is 1.0. * @memberof ModelAnimation.prototype * * @type {Number} * @readonly + * @deprecated This property has been deprecated. Use {@link ModelAnimation#multiplier} 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.multiplier instead.'); + return this._multiplier; } }, diff --git a/Source/Scene/ModelAnimationCollection.js b/Source/Scene/ModelAnimationCollection.js index d9d40f89cdda..4a484bc3d537 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.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. @@ -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.multiplier 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 + * multiplier : 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.multiplier instead.'); + options.multiplier = options.speedup; + } + + 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.'); @@ -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.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.speedup must be greater than zero. + * @exception {DeveloperError} options.multiplier must be greater than zero. * * @example * model.activeAnimations.addAll({ - * speedup : 0.5, // Play at half-speed + * multiplier : 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.multiplier instead.'); + options.multiplier = options.speedup; + } + + if (defined(options.multiplier) && (options.multiplier <= 0.0)) { + throw new DeveloperError('options.multiplier 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.multiplier); } var startTime = scheduledAnimation._computedStartTime; @@ -431,7 +444,7 @@ define([ delta = 1.0 - delta; } - var localAnimationTime = delta * duration * scheduledAnimation.speedup; + 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 f441a1a05d0f..2d50cd0887b9 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 multiplier is less than or equal to zero.', function() { expect(function() { return animBoxesModel.activeAnimations.addAll({ - speedup : 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.speedup).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 speedup 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', - speedup : 0.0 + multiplier : 0.0 }); }).toThrowDeveloperError(); }); @@ -1512,13 +1512,13 @@ defineSuite([ animBoxesModel.show = false; }); - it('Animates with a speedup', 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, - speedup : 1.5 + multiplier : 1.5 }); var spyUpdate = jasmine.createSpy('listener'); 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: + +