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
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
@@ -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;

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

viewer.clockViewModel.shouldAnimate = true;

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

@@ -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
@@ -93,6 +93,7 @@
}];

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

function scaleProperty(property, scalingFactor) {
Original file line number Diff line number Diff line change
@@ -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){
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML Model.html
Original file line number Diff line number Diff line change
@@ -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){
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/CZML Path.html
Original file line number Diff line number Diff line change
@@ -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');
});
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -98,6 +98,7 @@
}];

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


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

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

//Sandcastle_End
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/CZML.html
Original file line number Diff line number Diff line change
@@ -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'));
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Callback Property.html
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Cardboard.html
Original file line number Diff line number Diff line change
@@ -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',
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Clock.html
Original file line number Diff line number Diff line change
@@ -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', {
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/HeadingPitchRoll.html
Original file line number Diff line number Diff line change
@@ -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() {
3 changes: 3 additions & 0 deletions Apps/Sandcastle/gallery/Interpolation.html
Original file line number Diff line number Diff line change
@@ -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;

1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Particle System Fireworks.html
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Particle System.html
Original file line number Diff line number Diff line change
@@ -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);
@@ -287,7 +288,7 @@
lifeTime : 16.0,

emitter : new Cesium.CircleEmitter(2.0),

emitterModelMatrix : computeEmitterModelMatrix(),

forces : [applyGravity]
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Physically-Based Materials.html
Original file line number Diff line number Diff line change
@@ -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', {
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/Shadows.html
Original file line number Diff line number Diff line change
@@ -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,
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/Terrain Clipping Planes.html
Original file line number Diff line number Diff line change
@@ -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,
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Video.html
Original file line number Diff line number Diff line change
@@ -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');

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

function dataCallback(interval, index) {
var time;
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions Source/Core/Clock.js
Original file line number Diff line number Diff line change
@@ -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.
*
@@ -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, {
50 changes: 29 additions & 21 deletions Specs/Core/ClockSpec.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ defineSuite([
expect(clock.clockStep).toEqual(ClockStep.SYSTEM_CLOCK_MULTIPLIER);
expect(clock.clockRange).toEqual(ClockRange.UNBOUNDED);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('sets provided constructor parameters correctly', function() {
@@ -49,17 +49,17 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);

clock = new Clock({
canAnimate : false
});
expect(clock.canAnimate).toEqual(false);

clock = new Clock({
shouldAnimate : false
shouldAnimate : true
});
expect(clock.shouldAnimate).toEqual(false);
expect(clock.shouldAnimate).toEqual(true);
});

it('works when constructed with no currentTime parameter', function() {
@@ -82,7 +82,7 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('works when constructed with no startTime parameter', function() {
@@ -105,7 +105,7 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('works when constructed with no startTime or stopTime', function() {
@@ -127,7 +127,7 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('works when constructed with no startTime or currentTime', function() {
@@ -149,7 +149,7 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('works when constructed with no currentTime or stopTime', function() {
@@ -171,7 +171,7 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('works when constructed with no stopTime parameter', function() {
@@ -195,7 +195,7 @@ defineSuite([
expect(clock.clockRange).toEqual(range);
expect(clock.multiplier).toEqual(multiplier);
expect(clock.canAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(true);
expect(clock.shouldAnimate).toEqual(false);
});

it('throws when constructed if start time is after stop time', function() {
@@ -220,7 +220,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.LOOP_STOP
clockRange : ClockRange.LOOP_STOP,
shouldAnimate : true
});
expect(clock.currentTime).toEqual(currentTime);

@@ -244,7 +245,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.LOOP_STOP
clockRange : ClockRange.LOOP_STOP,
shouldAnimate : true
});
expect(clock.currentTime).toEqual(currentTime);

@@ -268,7 +270,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.UNBOUNDED
clockRange : ClockRange.UNBOUNDED,
shouldAnimate : true
});
expect(clock.currentTime).toEqual(currentTime);

@@ -292,7 +295,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.UNBOUNDED
clockRange : ClockRange.UNBOUNDED,
shouldAnimate : true
});
expect(clock.currentTime).toEqual(currentTime);

@@ -316,7 +320,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.LOOP_STOP
clockRange : ClockRange.LOOP_STOP,
shouldAnimate : true
});
expect(clock.currentTime).toEqual(currentTime);

@@ -340,7 +345,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.LOOP_STOP
clockRange : ClockRange.LOOP_STOP,
shouldAnimate : true
});

expect(clock.currentTime).toEqual(currentTime);
@@ -359,7 +365,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.CLAMPED
clockRange : ClockRange.CLAMPED,
shouldAnimate : true
});

expect(clock.currentTime).toEqual(currentTime);
@@ -378,7 +385,8 @@ defineSuite([
currentTime : currentTime,
clockStep : ClockStep.TICK_DEPENDENT,
multiplier : multiplier,
clockRange : ClockRange.CLAMPED
clockRange : ClockRange.CLAMPED,
shouldAnimate : true
});

expect(clock.currentTime).toEqual(currentTime);
@@ -465,8 +473,7 @@ defineSuite([
var clock = new Clock({
currentTime : new JulianDate(1),
clockStep : ClockStep.SYSTEM_CLOCK_MULTIPLIER,
multiplier : 1.5,
shouldAnimate : false
multiplier : 1.5
});

clock.clockStep = ClockStep.SYSTEM_CLOCK;
@@ -497,7 +504,8 @@ defineSuite([
it('uses multiplier in SYSTEM_CLOCK_MULTIPLIER mode', function() {
var clock = new Clock({
clockStep : ClockStep.SYSTEM_CLOCK_MULTIPLIER,
multiplier : 2.0
multiplier : 2.0,
shouldAnimate : true
});

var time1 = clock.tick();
3 changes: 2 additions & 1 deletion Specs/Scene/TimeDynamicImagerySpec.js
Original file line number Diff line number Diff line change
@@ -21,7 +21,8 @@ defineSuite([
'use strict';

var clock = new Clock({
clockStep : ClockStep.TICK_DEPENDENT
clockStep : ClockStep.TICK_DEPENDENT,
shouldAnimate : true
});

var times = TimeIntervalCollection.fromIso8601({
9 changes: 6 additions & 3 deletions Specs/Scene/WebMapTileServiceImageryProviderSpec.js
Original file line number Diff line number Diff line change
@@ -463,7 +463,8 @@ defineSuite([
}
});
var clock = new Clock({
currentTime : JulianDate.fromIso8601('2017-04-26')
currentTime : JulianDate.fromIso8601('2017-04-26'),
shouldAnimate : true
});

var provider = new WebMapTileServiceImageryProvider({
@@ -514,7 +515,8 @@ defineSuite([
}
});
var clock = new Clock({
currentTime : JulianDate.fromIso8601('2017-04-26')
currentTime : JulianDate.fromIso8601('2017-04-26'),
shouldAnimate : true
});

var provider = new WebMapTileServiceImageryProvider({
@@ -571,7 +573,8 @@ defineSuite([
});
var clock = new Clock({
currentTime : JulianDate.fromIso8601('2017-04-26'),
clockStep : ClockStep.TICK_DEPENDENT
clockStep : ClockStep.TICK_DEPENDENT,
shouldAnimate : true
});

loadImage.createImage = function(url, crossOrigin, deferred) {