Skip to content

Commit dc4ea0f

Browse files
authored
Merge pull request #6154 from AnalyticalGraphicsInc/dont-animate-by-default
Clock should not animate by default
2 parents a1e3c6a + 91b5873 commit dc4ea0f

29 files changed

+134
-53
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
var viewer = new Cesium.Viewer('cesiumContainer', {
8989
infoBox : false,
9090
selectionIndicator : false,
91-
shadows : true
91+
shadows : true,
92+
shouldAnimate : true
9293
});
9394

9495
var entity;

Apps/Sandcastle/gallery/3D Models.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
var viewer = new Cesium.Viewer('cesiumContainer', {
3131
infoBox : false,
3232
selectionIndicator : false,
33-
shadows : true
33+
shadows : true,
34+
shouldAnimate : true
3435
});
3536

3637
function createModel(url, height) {
@@ -94,4 +95,4 @@
9495
}
9596
</script>
9697
</body>
97-
</html>
98+
</html>

Apps/Sandcastle/gallery/CZML Custom Properties.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@
9292
}
9393
}];
9494

95-
var viewer = new Cesium.Viewer('cesiumContainer');
95+
var viewer = new Cesium.Viewer('cesiumContainer', {
96+
shouldAnimate : true
97+
});
98+
9699
var dataSource = new Cesium.CzmlDataSource();
97100

98101
function scaleProperty(property, scalingFactor) {

Apps/Sandcastle/gallery/CZML Model - Node Transformations.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@
7070
}
7171
}];
7272

73-
var viewer = new Cesium.Viewer('cesiumContainer');
73+
var viewer = new Cesium.Viewer('cesiumContainer', {
74+
shouldAnimate : true
75+
});
76+
7477
var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
7578

7679
dataSourcePromise.then(function(dataSource){

Apps/Sandcastle/gallery/CZML Model.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@
4545
}
4646
}];
4747

48-
var viewer = new Cesium.Viewer('cesiumContainer');
48+
var viewer = new Cesium.Viewer('cesiumContainer', {
49+
shouldAnimate : true
50+
});
51+
4952
var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
5053

5154
dataSourcePromise.then(function(dataSource){

Apps/Sandcastle/gallery/CZML Path.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -1864,17 +1864,18 @@
18641864
}];
18651865

18661866
var terrainProvider = new Cesium.CesiumTerrainProvider({
1867-
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
1868-
requestVertexNormals : true
1867+
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
1868+
requestVertexNormals : true
18691869
});
18701870

18711871
var viewer = new Cesium.Viewer('cesiumContainer', {
1872-
terrainProvider : terrainProvider,
1873-
baseLayerPicker : false
1872+
terrainProvider : terrainProvider,
1873+
baseLayerPicker : false,
1874+
shouldAnimate : true
18741875
});
18751876

18761877
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) {
1877-
viewer.trackedEntity = ds.entities.getById('path');
1878+
viewer.trackedEntity = ds.entities.getById('path');
18781879
});
18791880

18801881
//Sandcastle_End

Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
}
5757
}];
5858

59-
var viewer = new Cesium.Viewer('cesiumContainer');
59+
var viewer = new Cesium.Viewer('cesiumContainer', {
60+
shouldAnimate : true
61+
});
62+
6063
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
6164

6265
//Sandcastle_End

Apps/Sandcastle/gallery/CZML Polygon - Interpolating References.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@
9797
}
9898
}];
9999

100-
var viewer = new Cesium.Viewer('cesiumContainer');
100+
var viewer = new Cesium.Viewer('cesiumContainer', {
101+
shouldAnimate : true
102+
});
103+
101104
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
102105

103106

Apps/Sandcastle/gallery/CZML Polygon - Intervals, Availability.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@
138138
}
139139
}];
140140

141-
var viewer = new Cesium.Viewer('cesiumContainer');
141+
var viewer = new Cesium.Viewer('cesiumContainer', {
142+
shouldAnimate : true
143+
});
144+
142145
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
143146

144147
//Sandcastle_End

Apps/Sandcastle/gallery/CZML.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
function startup(Cesium) {
2929
'use strict';
3030
//Sandcastle_Begin
31-
var viewer = new Cesium.Viewer('cesiumContainer');
31+
var viewer = new Cesium.Viewer('cesiumContainer', {
32+
shouldAnimate : true
33+
});
3234

3335
Sandcastle.addDefaultToolbarButton('Satellites', function() {
3436
viewer.dataSources.add(Cesium.CzmlDataSource.load('../../SampleData/simple.czml'));

Apps/Sandcastle/gallery/Callback Property.html

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// Use a CallbackProperty when your data can't be pre-computed
3333
// or needs to be derived from other properties at runtime.
3434
var viewer = new Cesium.Viewer('cesiumContainer');
35+
viewer.clock.shouldAnimate = true;
3536

3637
var startLatitude = 35;
3738
var startLongitude = -120;

Apps/Sandcastle/gallery/Cardboard.html

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
viewer.clock.currentTime = start.clone();
5353
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
5454
viewer.clock.multiplier = 1.0;
55+
viewer.clock.shouldAnimate = true;
5556

5657
function computeCirclularFlight(lon, lat, radius) {
5758
var property = new Cesium.SampledPositionProperty();

Apps/Sandcastle/gallery/Clock.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
stopTime : Cesium.JulianDate.fromIso8601("2013-12-26"),
3535
clockRange : Cesium.ClockRange.LOOP_STOP, // loop when we hit the end time
3636
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,
37-
multiplier : 4000 // how much time to advance each tick
37+
multiplier : 4000, // how much time to advance each tick
38+
shouldAnimate : true // Animation on by default
3839
});
3940

4041
var viewer = new Cesium.Viewer('cesiumContainer', {

Apps/Sandcastle/gallery/HeadingPitchRoll.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ <h1>Loading...</h1>
6767
function startup(Cesium) {
6868
'use strict';
6969
//Sandcastle_Begin
70-
var viewer = new Cesium.Viewer('cesiumContainer');
70+
var viewer = new Cesium.Viewer('cesiumContainer', {
71+
shouldAnimate : true
72+
});
73+
7174
var canvas = viewer.canvas;
7275
canvas.setAttribute('tabindex', '0'); // needed to put focus on the canvas
7376
canvas.addEventListener('click', function() {

Apps/Sandcastle/gallery/Interpolation.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
var viewer = new Cesium.Viewer('cesiumContainer', {
3333
terrainProviderViewModels : [], //Disable terrain changing
3434
infoBox : false, //Disable InfoBox widget
35-
selectionIndicator : false //Disable selection indicator
35+
selectionIndicator : false, //Disable selection indicator
36+
shouldAnimate : true // Enable animations
3637
});
3738

3839
//Enable lighting based on sun/moon positions

Apps/Sandcastle/gallery/Particle System Fireworks.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
function startup(Cesium) {
2929
'use strict';
3030
//Sandcastle_Begin
31-
var viewer = new Cesium.Viewer('cesiumContainer');
31+
var viewer = new Cesium.Viewer('cesiumContainer', {
32+
shouldAnimate : true
33+
});
3234

3335
var scene = viewer.scene;
3436
scene.debugShowFramesPerSecond = true;

Apps/Sandcastle/gallery/Particle System.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
viewer.clock.currentTime = start.clone();
156156
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the end
157157
viewer.clock.multiplier = 1;
158+
viewer.clock.shouldAnimate = true;
158159

159160
//Set timeline to simulation bounds
160161
viewer.timeline.zoomTo(start, stop);
@@ -287,7 +288,7 @@
287288
lifeTime : 16.0,
288289

289290
emitter : new Cesium.CircleEmitter(2.0),
290-
291+
291292
emitterModelMatrix : computeEmitterModelMatrix(),
292293

293294
forces : [applyGravity]

Apps/Sandcastle/gallery/Physically-Based Materials.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
currentTime : Cesium.JulianDate.fromIso8601("2017-07-11T10:00:00Z"),
3434
clockRange : Cesium.ClockRange.LOOP_STOP,
3535
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,
36-
multiplier : 1000
36+
multiplier : 1000,
37+
shouldAnimate : true
3738
});
3839

3940
var viewer = new Cesium.Viewer('cesiumContainer', {

Apps/Sandcastle/gallery/Shadows.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
infoBox : false,
3434
selectionIndicator : false,
3535
shadows : true,
36-
terrainShadows : Cesium.ShadowMode.ENABLED
36+
terrainShadows : Cesium.ShadowMode.ENABLED,
37+
shouldAnimate : true
3738
});
3839

3940
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({

Apps/Sandcastle/gallery/Terrain Clipping Planes.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
// Clipping planes are not currently supported in Internet Explorer.
4444

4545
var viewer = new Cesium.Viewer('cesiumContainer', {
46-
skyAtmosphere: false
46+
skyAtmosphere: false,
47+
shouldAnimate : true
4748
});
4849

4950
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({

Apps/Sandcastle/gallery/Video.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
function startup(Cesium) {
4444
'use strict';
4545
//Sandcastle_Begin
46-
var viewer = new Cesium.Viewer('cesiumContainer', {showRenderLoopErrors : false});
46+
var viewer = new Cesium.Viewer('cesiumContainer', {
47+
showRenderLoopErrors : false,
48+
shouldAnimate : true
49+
});
4750

4851
var videoElement = document.getElementById('trailer');
4952

Apps/Sandcastle/gallery/Web Map Tile Service with Time.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
function startup(Cesium) {
2828
'use strict';
2929
//Sandcastle_Begin
30-
var viewer = new Cesium.Viewer('cesiumContainer');
30+
var viewer = new Cesium.Viewer('cesiumContainer', {
31+
shouldAnimate : true
32+
});
3133

3234
function dataCallback(interval, index) {
3335
var time;

CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Change Log
44
### 1.42 - 2018-02-01
55

66
* Breaking changes
7-
*
7+
* The clock does not animate by default. Set the `shouldAnimate` option to `true` when creating the Viewer to enable animation.
88
* Deprecated
99
* For all classes/functions that can now take a `Resource` instance, all additional parameters that are part of the `Resource` class have been deprecated and will be removed in Cesium 1.44. This generally includes `proxy`, `headers` and `query` parameters.
1010
* Major refactor of URL handling. All classes that take a url parameter, can now take a Resource or a String. This includes all imagery providers, all terrain providers, `Cesium3DTileset`, `KMLDataSource`, `CZMLDataSource`, `GeoJsonDataSource`, `Model`, `Billboard`, along with all the low level `load*()` functions.
@@ -34,6 +34,7 @@ Change Log
3434
* Fixed a glTF animation bug that caused certain animations to jitter. [#5740](https://github.com/AnalyticalGraphicsInc/cesium/pull/5740)
3535
* Fixed a bug when creating billboard and model entities without a globe. [#6109](https://github.com/AnalyticalGraphicsInc/cesium/pull/6109)
3636
* Added support for vertex shader uniforms when `tileset.colorBlendMode` is `MIX` or `REPLACE`. [#5874](https://github.com/AnalyticalGraphicsInc/cesium/pull/5874)
37+
* Added `shouldAnimate` option to the `Viewer` constructor to indicate if the clock should begin animating immediately.[#6154](https://github.com/AnalyticalGraphicsInc/cesium/pull/6154)
3738
* Added separate file for the Cesium [Code of Conduct](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CODE_OF_CONDUCT.md). [#6129](https://github.com/AnalyticalGraphicsInc/cesium/pull/6129)
3839
* Fixed applying a translucent style to a point cloud tileset. [#6113](https://github.com/AnalyticalGraphicsInc/cesium/pull/6113)
3940
* Fixed sandcastle Particle System example for better visual [#6132](https://github.com/AnalyticalGraphicsInc/cesium/pull/6132)

Source/Core/Clock.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define([
3434
* @param {ClockStep} [options.clockStep=ClockStep.SYSTEM_CLOCK_MULTIPLIER] Determines if calls to {@link Clock#tick} are frame dependent or system clock dependent.
3535
* @param {ClockRange} [options.clockRange=ClockRange.UNBOUNDED] Determines how the clock should behave when {@link Clock#startTime} or {@link Clock#stopTime} is reached.
3636
* @param {Boolean} [options.canAnimate=true] Indicates whether {@link Clock#tick} can advance time. This could be false if data is being buffered, for example. The clock will only tick when both {@link Clock#canAnimate} and {@link Clock#shouldAnimate} are true.
37-
* @param {Boolean} [options.shouldAnimate=true] Indicates whether {@link Clock#tick} should attempt to advance time. The clock will only tick when both {@link Clock#canAnimate} and {@link Clock#shouldAnimate} are true.
37+
* @param {Boolean} [options.shouldAnimate=false] Indicates whether {@link Clock#tick} should attempt to advance time. The clock will only tick when both {@link Clock#canAnimate} and {@link Clock#shouldAnimate} are true.
3838
*
3939
* @exception {DeveloperError} startTime must come before stopTime.
4040
*
@@ -144,8 +144,8 @@ define([
144144

145145
this.currentTime = currentTime;
146146
this.multiplier = defaultValue(options.multiplier, 1.0);
147+
this.shouldAnimate = defaultValue(options.shouldAnimate, false);
147148
this.clockStep = defaultValue(options.clockStep, ClockStep.SYSTEM_CLOCK_MULTIPLIER);
148-
this.shouldAnimate = defaultValue(options.shouldAnimate, true);
149149
}
150150

151151
defineProperties(Clock.prototype, {

Source/Widgets/Viewer/Viewer.js

+5
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ define([
266266
* @param {Boolean} [options.navigationHelpButton=true] If set to false, the navigation help button will not be created.
267267
* @param {Boolean} [options.navigationInstructionsInitiallyVisible=true] True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button.
268268
* @param {Boolean} [options.scene3DOnly=false] When <code>true</code>, each geometry instance will only be rendered in 3D to save GPU memory.
269+
* @param {Boolean} [options.shouldAnimate=false] <code>true</code> if the clock should attempt to advance simulation time by default, <code>false</code> otherwise. This option takes precedence over setting {@link Viewer#clockViewModel}.
269270
* @param {ClockViewModel} [options.clockViewModel=new ClockViewModel(options.clock)] The clock view model to use to control current time.
270271
* @param {ProviderViewModel} [options.selectedImageryProviderViewModel] The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if options.baseLayerPicker is set to true.
271272
* @param {ProviderViewModel[]} [options.imageryProviderViewModels=createDefaultImageryProviderViewModels()] The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true.
@@ -421,6 +422,10 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
421422
destroyClockViewModel = true;
422423
}
423424

425+
if (defined(options.shouldAnimate)) {
426+
clock.shouldAnimate = options.shouldAnimate;
427+
}
428+
424429
// Cesium widget
425430
var cesiumWidget = new CesiumWidget(cesiumWidgetContainer, {
426431
terrainProvider : options.terrainProvider,

0 commit comments

Comments
 (0)