Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock should not animate by default #6154

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/3D Models Coloring.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
selectionIndicator : false,
shadows : true
});
viewer.clockViewModel.shouldAnimate = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend changing all of these to simple viewer.clock.shouldAnimate, since it's clearer and doesn't require the timeline/animation widget to be present.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does this particular example need animation? May be better to just not animate here (and choose a time that shows shadows so they always toggle, which right now only happens if the clock happens to be at a certain time).


var entity;

Expand Down
4 changes: 3 additions & 1 deletion Apps/Sandcastle/gallery/3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
shadows : true
});

viewer.clockViewModel.shouldAnimate = true;

function createModel(url, height) {
viewer.entities.removeAll();

Expand Down Expand Up @@ -94,4 +96,4 @@
}
</script>
</body>
</html>
</html>
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML Custom Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;
var dataSource = new Cesium.CzmlDataSource();

function scaleProperty(property, scalingFactor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;
var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

dataSourcePromise.then(function(dataSource){
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML Model.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;
var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

dataSourcePromise.then(function(dataSource){
Expand Down
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/CZML Path.html
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,8 @@
baseLayerPicker : false
});

viewer.clockViewModel.shouldAnimate = true;

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) {
viewer.trackedEntity = ds.entities.getById('path');
});
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;cz,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/paste error: cz,

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

//Sandcastle_End
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

//Sandcastle_End
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;

Sandcastle.addDefaultToolbarButton('Satellites', function() {
viewer.dataSources.add(Cesium.CzmlDataSource.load('../../SampleData/simple.czml'));
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Callback Property.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
// Use a CallbackProperty when your data can't be pre-computed
// or needs to be derived from other properties at runtime.
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;

var startLatitude = 35;
var startLongitude = -120;
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Cardboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
// Click the VR button in the bottom right of the screen to switch to VR mode.

viewer.scene.globe.enableLighting = true;
viewer.clockViewModel.shouldAnimate = true;

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Clock.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
stopTime : Cesium.JulianDate.fromIso8601("2013-12-26"),
clockRange : Cesium.ClockRange.LOOP_STOP, // loop when we hit the end time
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,
multiplier : 4000 // how much time to advance each tick
multiplier : 4000, // how much time to advance each tick
shouldAnimate : true // Animation on by default
});

var viewer = new Cesium.Viewer('cesiumContainer', {
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/HeadingPitchRoll.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ <h1>Loading...</h1>
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;
var canvas = viewer.canvas;
canvas.setAttribute('tabindex', '0'); // needed to put focus on the canvas
canvas.addEventListener('click', function() {
Expand Down
3 changes: 3 additions & 0 deletions Apps/Sandcastle/gallery/Interpolation.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
selectionIndicator : false //Disable selection indicator
});

// Enable animations
viewer.clockViewModel.shouldAnimate = true;

//Enable lighting based on sun/moon positions
viewer.scene.globe.enableLighting = true;

Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Particle System Fireworks.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;

var scene = viewer.scene;
scene.debugShowFramesPerSecond = true;
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Particle System.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;

//Set the random number seed for consistent results.
Cesium.Math.setRandomNumberSeed(3);
Expand Down Expand Up @@ -287,7 +288,7 @@
lifeTime : 16.0,

emitter : new Cesium.CircleEmitter(2.0),

emitterModelMatrix : computeEmitterModelMatrix(),

forces : [applyGravity]
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Physically-Based Materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
currentTime : Cesium.JulianDate.fromIso8601("2017-07-11T10:00:00Z"),
clockRange : Cesium.ClockRange.LOOP_STOP,
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,
multiplier : 1000
multiplier : 1000,
shouldAnimate : true
});

var viewer = new Cesium.Viewer('cesiumContainer', {
Expand Down
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/Shadows.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
terrainShadows : Cesium.ShadowMode.ENABLED
});

viewer.clockViewModel.shouldAnimate = true;

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
requestWaterMask : true,
Expand Down
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/Terrain Clipping Planes.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
skyAtmosphere: false
});

viewer.clockViewModel.shouldAnimate = true;

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
requestWaterMask : true,
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Video.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {showRenderLoopErrors : false});
viewer.clockViewModel.shouldAnimate = true;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clockViewModel.shouldAnimate = true;

function dataCallback(interval, index) {
var time;
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Change Log
### 1.42 - 2018-02-01

* Breaking changes
*
* The clock does not animate by default. Set the viewer `ClockViewModel.shouldAnimate` property to `true` to enable animation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use viewer.clock.shouldAnimate here instead of "viewer ClockViewModel.shouldAnimate"

* Deprecated
* 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.
* 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.
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ define([
* @param {ClockStep} [options.clockStep=ClockStep.SYSTEM_CLOCK_MULTIPLIER] Determines if calls to {@link Clock#tick} are frame dependent or system clock dependent.
* @param {ClockRange} [options.clockRange=ClockRange.UNBOUNDED] Determines how the clock should behave when {@link Clock#startTime} or {@link Clock#stopTime} is reached.
* @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.
* @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.
* @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.
*
* @exception {DeveloperError} startTime must come before stopTime.
*
Expand Down Expand Up @@ -144,8 +144,8 @@ define([

this.currentTime = currentTime;
this.multiplier = defaultValue(options.multiplier, 1.0);
this.shouldAnimate = defaultValue(options.shouldAnimate, false);
this.clockStep = defaultValue(options.clockStep, ClockStep.SYSTEM_CLOCK_MULTIPLIER);
this.shouldAnimate = defaultValue(options.shouldAnimate, true);
}

defineProperties(Clock.prototype, {
Expand Down
Loading