@anov/gis-skills-cli 0.0.0-stage → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +637 -0
- package/INSTALL.md +481 -0
- package/LICENSE +15 -0
- package/README.md +148 -2
- package/RELEASING.md +162 -0
- package/bin/anov-gis-skills.mjs +470 -0
- package/lib/mcp-config.mjs +273 -0
- package/package.json +43 -4
- package/skills/anovgis-analysis/SKILL.md +585 -0
- package/skills/anovgis-effects/SKILL.md +260 -0
- package/skills/anovgis-imagery-terrain/SKILL.md +505 -0
- package/skills/anovgis-layers/SKILL.md +627 -0
- package/skills/anovgis-materials/SKILL.md +635 -0
- package/skills/anovgis-models-3dtiles/SKILL.md +448 -0
- package/skills/anovgis-pitfalls/SKILL.md +561 -0
- package/skills/anovgis-popup-widget/SKILL.md +474 -0
- package/skills/anovgis-primitives/SKILL.md +482 -0
- package/skills/anovgis-vector-graphics/SKILL.md +602 -0
- package/skills/anovgis-viewer/SKILL.md +618 -0
- package/skills/using-anovgis/DEMO-MAP.md +64 -0
- package/skills/using-anovgis/DEMO-SKILL-MAP.md +248 -0
- package/skills/using-anovgis/DOMAINS.md +183 -0
- package/skills/using-anovgis/REFERENCE.md +114 -0
- package/skills/using-anovgis/SKILL.md +392 -0
- package/skills/using-anovgis/templates/README.md +154 -0
- package/skills/using-anovgis/templates/combo1-vue3-vite.md +295 -0
- package/skills/using-anovgis/templates/combo2-vue2-cli.md +119 -0
- package/skills/using-anovgis/templates/combo3-html-cdn.md +107 -0
- package/skills/using-anovgis/templates/combo4-vanilla-webpack.md +91 -0
- package/skills/using-anovgis/templates/wizard-profiles.md +105 -0
- package/vendor/cesiumjs-skills/LICENSE +201 -0
- package/vendor/cesiumjs-skills/NOTICE +18 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-3d-tiles/SKILL.md +465 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-camera/SKILL.md +500 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-core-utilities/SKILL.md +403 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/REFERENCE.md +397 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/SKILL.md +351 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/01-diffuse-tint.js +38 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/02-texture-swap.js +42 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/03-feature-id-tileset.js +29 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/04-translucent-override.js +37 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/05-vertex-displacement.js +49 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/06-metadata-ramp.js +34 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/07-voxel-shader.js +27 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/README.md +19 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/_sandcastle-template.html +9 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-entities/SKILL.md +389 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-imagery/SKILL.md +471 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-interaction/SKILL.md +423 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-materials-shaders/SKILL.md +292 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-models-particles/SKILL.md +423 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-primitives/SKILL.md +537 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-spatial-math/SKILL.md +358 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-terrain-environment/SKILL.md +401 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-time-properties/SKILL.md +353 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-viewer-setup/SKILL.md +434 -0
- package/vendor/cesiumjs-skills/skills/using-cesiumjs-skills/SKILL.md +35 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cesiumjs-time-properties
|
|
3
|
+
description: "CesiumJS time, properties, and animation - Clock, JulianDate, TimeInterval, Property, SampledProperty, CallbackProperty, interpolation, splines, CZML temporal data. Use when making entity attributes time-dynamic, configuring the simulation clock, interpolating positions over time, or working with sampled or callback properties."
|
|
4
|
+
---
|
|
5
|
+
# CesiumJS Time, Properties & Animation
|
|
6
|
+
|
|
7
|
+
Version baseline: CesiumJS v1.142
|
|
8
|
+
|
|
9
|
+
Covers the temporal data-binding layer: Clock/JulianDate time system, the Property hierarchy that makes entity attributes change over time, interpolation algorithms, splines, and material properties. Properties live here (not with Entities) because SampledProperty and CallbackProperty are meaningless without Clock/JulianDate. The Material class (Fabric) belongs in cesiumjs-materials-shaders.
|
|
10
|
+
|
|
11
|
+
## JulianDate -- The Time Primitive
|
|
12
|
+
|
|
13
|
+
Stores whole days + fractional seconds separately for precision. Always uses TAI internally.
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { JulianDate } from "cesium";
|
|
17
|
+
|
|
18
|
+
// Creation: fromIso8601 (most common), fromDate, now
|
|
19
|
+
const date = JulianDate.fromIso8601("2025-06-15T12:00:00Z");
|
|
20
|
+
const jd = JulianDate.fromDate(new Date("2025-06-15T12:00:00Z"));
|
|
21
|
+
const now = JulianDate.now();
|
|
22
|
+
|
|
23
|
+
// Conversion: toIso8601, toDate, toGregorianDate
|
|
24
|
+
const iso = JulianDate.toIso8601(date); // "2025-06-15T12:00:00Z"
|
|
25
|
+
const greg = JulianDate.toGregorianDate(date); // {year, month, day, hour, ...}
|
|
26
|
+
|
|
27
|
+
// Arithmetic -- all require a result parameter to avoid allocations
|
|
28
|
+
const r = new JulianDate();
|
|
29
|
+
JulianDate.addSeconds(date, 3600, r); // also: addMinutes, addHours, addDays
|
|
30
|
+
|
|
31
|
+
// Differences and comparisons
|
|
32
|
+
const stop = JulianDate.addHours(date, 24, new JulianDate());
|
|
33
|
+
JulianDate.secondsDifference(stop, date); // 86400
|
|
34
|
+
JulianDate.lessThan(date, stop); // true
|
|
35
|
+
JulianDate.compare(date, stop); // negative (date < stop)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Clock -- Simulation Time Controller
|
|
39
|
+
|
|
40
|
+
The Viewer creates a Clock automatically. Configure it to control playback speed and bounds.
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import { Viewer, JulianDate, ClockRange, ClockStep } from "cesium";
|
|
44
|
+
|
|
45
|
+
const viewer = new Viewer("cesiumContainer");
|
|
46
|
+
const start = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
|
|
47
|
+
const stop = JulianDate.addHours(start, 24, new JulianDate());
|
|
48
|
+
viewer.clock.startTime = start.clone();
|
|
49
|
+
viewer.clock.stopTime = stop.clone();
|
|
50
|
+
viewer.clock.currentTime = start.clone();
|
|
51
|
+
viewer.clock.clockRange = ClockRange.LOOP_STOP; // loop at end
|
|
52
|
+
viewer.clock.multiplier = 60; // 60x real-time
|
|
53
|
+
viewer.clock.shouldAnimate = true;
|
|
54
|
+
viewer.timeline.zoomTo(start, stop);
|
|
55
|
+
|
|
56
|
+
viewer.clock.onTick.addEventListener((clock) => { // per-frame callback
|
|
57
|
+
console.log(JulianDate.toIso8601(clock.currentTime));
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| ClockRange | Behavior |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `UNBOUNDED` | Advances forever in both directions |
|
|
64
|
+
| `CLAMPED` | Stops at start/stop time |
|
|
65
|
+
| `LOOP_STOP` | Wraps from stop back to start |
|
|
66
|
+
|
|
67
|
+
| ClockStep | Behavior |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `TICK_DEPENDENT` | Each tick advances by `multiplier` seconds (frame-dependent) |
|
|
70
|
+
| `SYSTEM_CLOCK_MULTIPLIER` | Elapsed wall time x `multiplier` (default) |
|
|
71
|
+
| `SYSTEM_CLOCK` | Real-time; ignores multiplier |
|
|
72
|
+
|
|
73
|
+
## TimeInterval & TimeIntervalCollection
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
import { TimeInterval, TimeIntervalCollection, JulianDate } from "cesium";
|
|
77
|
+
|
|
78
|
+
const interval = TimeInterval.fromIso8601({
|
|
79
|
+
iso8601: "2025-06-15T00:00:00Z/2025-06-16T00:00:00Z",
|
|
80
|
+
data: { phase: "daylight" }, // attach arbitrary data
|
|
81
|
+
});
|
|
82
|
+
TimeInterval.contains(interval, JulianDate.fromIso8601("2025-06-15T12:00:00Z")); // true
|
|
83
|
+
|
|
84
|
+
// Used by Entity.availability to cull entities outside the time window
|
|
85
|
+
const availability = new TimeIntervalCollection([
|
|
86
|
+
new TimeInterval({
|
|
87
|
+
start: JulianDate.fromIso8601("2025-06-15T00:00:00Z"),
|
|
88
|
+
stop: JulianDate.fromIso8601("2025-06-16T00:00:00Z"),
|
|
89
|
+
}),
|
|
90
|
+
]);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Property System -- Time-Varying Values
|
|
94
|
+
|
|
95
|
+
Every entity attribute is a Property. CesiumJS calls `property.getValue(time)` each frame.
|
|
96
|
+
|
|
97
|
+
### ConstantProperty
|
|
98
|
+
|
|
99
|
+
Returns the same value regardless of time. CesiumJS auto-wraps raw values, so explicit use is rare.
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import { ConstantProperty, Color } from "cesium";
|
|
103
|
+
const prop = new ConstantProperty(Color.RED);
|
|
104
|
+
prop.setValue(Color.BLUE); // fires definitionChanged
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### SampledProperty -- Interpolated Time Series
|
|
108
|
+
|
|
109
|
+
Stores discrete samples and interpolates. Type can be `Number`, `Cartesian3`, `Color`, or any `Packable`.
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { SampledProperty, JulianDate, LagrangePolynomialApproximation, ExtrapolationType } from "cesium";
|
|
113
|
+
|
|
114
|
+
const prop = new SampledProperty(Number);
|
|
115
|
+
const t0 = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
|
|
116
|
+
prop.addSample(t0, 1.0);
|
|
117
|
+
prop.addSample(JulianDate.addSeconds(t0, 60, new JulianDate()), 2.5);
|
|
118
|
+
prop.addSample(JulianDate.addSeconds(t0, 120, new JulianDate()), 1.0);
|
|
119
|
+
prop.getValue(JulianDate.addSeconds(t0, 30, new JulianDate())); // ~1.75
|
|
120
|
+
|
|
121
|
+
// Default: LinearApproximation degree 1. Switch to smoother Lagrange:
|
|
122
|
+
prop.setInterpolationOptions({ interpolationDegree: 5, interpolationAlgorithm: LagrangePolynomialApproximation });
|
|
123
|
+
prop.forwardExtrapolationType = ExtrapolationType.HOLD; // hold last value outside range
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### SampledPositionProperty -- Interpolated Positions
|
|
127
|
+
|
|
128
|
+
Specialized for Cartesian3 positions. Supports reference frames (`ReferenceFrame.FIXED` default, or `INERTIAL`).
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
import { SampledPositionProperty, JulianDate, Cartesian3, LagrangePolynomialApproximation, ExtrapolationType } from "cesium";
|
|
132
|
+
|
|
133
|
+
const position = new SampledPositionProperty();
|
|
134
|
+
const start = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
|
|
135
|
+
for (let i = 0; i <= 360; i += 45) {
|
|
136
|
+
const rad = (i * Math.PI) / 180;
|
|
137
|
+
position.addSample(
|
|
138
|
+
JulianDate.addSeconds(start, i, new JulianDate()),
|
|
139
|
+
Cartesian3.fromDegrees(-112 + 0.045 * Math.cos(rad), 36 + 0.03 * Math.sin(rad), 2000 + Math.random() * 500),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
position.setInterpolationOptions({ interpolationDegree: 5, interpolationAlgorithm: LagrangePolynomialApproximation });
|
|
143
|
+
position.forwardExtrapolationType = ExtrapolationType.HOLD;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
| Algorithm | Best For | Degree |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `LinearApproximation` | Fast piecewise-linear | 1 (fixed) |
|
|
149
|
+
| `LagrangePolynomialApproximation` | Smooth curves from sparse samples | 1--9 |
|
|
150
|
+
| `HermitePolynomialApproximation` | Smooth curves with velocity derivatives | 1--9 |
|
|
151
|
+
|
|
152
|
+
### CallbackProperty -- Computed on Demand
|
|
153
|
+
|
|
154
|
+
Evaluates a function every frame. Second argument (`isConstant`) must be `false` if value changes.
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
import { CallbackProperty, Color, JulianDate } from "cesium";
|
|
158
|
+
|
|
159
|
+
const startTime = JulianDate.now();
|
|
160
|
+
const pulse = new CallbackProperty((time, result) => {
|
|
161
|
+
const s = JulianDate.secondsDifference(time, startTime);
|
|
162
|
+
return Color.RED.withAlpha(0.5 + 0.5 * Math.sin(s * 2), result ?? new Color());
|
|
163
|
+
}, false);
|
|
164
|
+
|
|
165
|
+
// Growing polygon -- mutate the array, property auto-updates
|
|
166
|
+
const pts = [/* initial Cartesian3[] */];
|
|
167
|
+
const dynamicPts = new CallbackProperty(() => pts, false);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### CompositeProperty -- Stitching Properties Over Time
|
|
171
|
+
|
|
172
|
+
Delegates to different sub-properties for different time ranges. Each interval's `data` is a Property.
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
import { CompositeProperty, ConstantProperty, SampledProperty, TimeInterval, JulianDate } from "cesium";
|
|
176
|
+
|
|
177
|
+
const composite = new CompositeProperty();
|
|
178
|
+
composite.intervals.addInterval(TimeInterval.fromIso8601({
|
|
179
|
+
iso8601: "2025-06-15T00:00:00Z/2025-06-15T12:00:00Z", data: new ConstantProperty(1.0) }));
|
|
180
|
+
const sampled = new SampledProperty(Number);
|
|
181
|
+
sampled.addSample(JulianDate.fromIso8601("2025-06-15T12:00:00Z"), 1.0);
|
|
182
|
+
sampled.addSample(JulianDate.fromIso8601("2025-06-16T00:00:00Z"), 5.0);
|
|
183
|
+
composite.intervals.addInterval(TimeInterval.fromIso8601({
|
|
184
|
+
iso8601: "2025-06-15T12:00:00Z/2025-06-16T00:00:00Z", isStartIncluded: false, data: sampled }));
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### VelocityOrientationProperty -- Auto-Orient Along Path
|
|
188
|
+
|
|
189
|
+
Computes Quaternion from a position property's velocity. Essential for vehicles and aircraft.
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
import { VelocityOrientationProperty, SampledPositionProperty } from "cesium";
|
|
193
|
+
const position = new SampledPositionProperty();
|
|
194
|
+
// ... add samples ...
|
|
195
|
+
viewer.entities.add({
|
|
196
|
+
position, orientation: new VelocityOrientationProperty(position),
|
|
197
|
+
model: { uri: "aircraft.glb", minimumPixelSize: 64 },
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### ReferenceProperty -- Cross-Entity Binding
|
|
202
|
+
|
|
203
|
+
Links one entity's property to another by ID string (`"entityId#propertyPath"`).
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
import { ReferenceProperty } from "cesium";
|
|
207
|
+
viewer.entities.add({ id: "leader", position: Cartesian3.fromDegrees(-75, 40, 1000) });
|
|
208
|
+
viewer.entities.add({ id: "follower",
|
|
209
|
+
position: ReferenceProperty.fromString(viewer.entities, "leader#position"),
|
|
210
|
+
point: { pixelSize: 10 } });
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Material Properties
|
|
214
|
+
|
|
215
|
+
Control entity surface appearance. All options accept raw values or Property instances for time-dynamic behavior. Surface types: `ColorMaterialProperty`, `ImageMaterialProperty`, `GridMaterialProperty`, `StripeMaterialProperty`, `CheckerboardMaterialProperty`. Polyline types: `PolylineArrowMaterialProperty`, `PolylineDashMaterialProperty`, `PolylineGlowMaterialProperty`, `PolylineOutlineMaterialProperty`.
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
import { ColorMaterialProperty, SampledProperty, Color, JulianDate } from "cesium";
|
|
219
|
+
|
|
220
|
+
const solid = new ColorMaterialProperty(Color.RED);
|
|
221
|
+
|
|
222
|
+
// Time-varying color via SampledProperty
|
|
223
|
+
const colorProp = new SampledProperty(Color);
|
|
224
|
+
const t0 = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
|
|
225
|
+
colorProp.addSample(t0, Color.BLUE);
|
|
226
|
+
colorProp.addSample(JulianDate.addHours(t0, 6, new JulianDate()), Color.RED);
|
|
227
|
+
const animated = new ColorMaterialProperty(colorProp);
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Splines -- Parametric Curve Interpolation
|
|
231
|
+
|
|
232
|
+
Splines use unitless parametric time (not JulianDate) for smooth animation curves.
|
|
233
|
+
|
|
234
|
+
```js
|
|
235
|
+
import { HermiteSpline, CatmullRomSpline, Cartesian3 } from "cesium";
|
|
236
|
+
|
|
237
|
+
// Natural cubic (C2, auto-tangents)
|
|
238
|
+
const spline = HermiteSpline.createNaturalCubic({
|
|
239
|
+
times: [0, 1.5, 3, 4.5, 6],
|
|
240
|
+
points: [
|
|
241
|
+
new Cartesian3(1235398, -4810983, 4146266), new Cartesian3(1372574, -5345182, 4606657),
|
|
242
|
+
new Cartesian3(-757983, -5542796, 4514323), new Cartesian3(-2821260, -5248423, 4021290),
|
|
243
|
+
new Cartesian3(-2539788, -4724797, 3620093) ],
|
|
244
|
+
});
|
|
245
|
+
const point = spline.evaluate(2.0); // evaluate at parametric time t=2
|
|
246
|
+
|
|
247
|
+
// CatmullRom (C1, auto-tangents from control points)
|
|
248
|
+
const catmull = new CatmullRomSpline({ times: [0, 1, 2, 3], points: [p0, p1, p2, p3] });
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
| Spline | Use |
|
|
252
|
+
|---|---|
|
|
253
|
+
| `LinearSpline` | Piecewise-linear (C0), cheapest |
|
|
254
|
+
| `HermiteSpline` | Cubic with tangents (C1+); factories: `createNaturalCubic`, `createClampedCubic`, `createC1` |
|
|
255
|
+
| `CatmullRomSpline` | Auto-tangents from control points (C1) |
|
|
256
|
+
| `QuaternionSpline` | Rotation interpolation via SLERP (C1) |
|
|
257
|
+
| `ConstantSpline` | Single value for all times |
|
|
258
|
+
| `SteppedSpline` | Holds value until next control point |
|
|
259
|
+
| `MorphWeightSpline` | glTF morph target weights (C1) |
|
|
260
|
+
|
|
261
|
+
## CZML Temporal Data
|
|
262
|
+
|
|
263
|
+
CZML streams time-dynamic data. The `document` packet sets the clock; entity packets use `epoch` + offset arrays for compact positions. Position format: `[secondsFromEpoch, lon, lat, alt, ...]`.
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
import { Viewer, CzmlDataSource } from "cesium";
|
|
267
|
+
const czml = [
|
|
268
|
+
{ id: "document", version: "1.0", clock: {
|
|
269
|
+
interval: "2025-06-15T00:00:00Z/2025-06-15T06:00:00Z",
|
|
270
|
+
currentTime: "2025-06-15T00:00:00Z", multiplier: 60,
|
|
271
|
+
range: "LOOP_STOP", step: "SYSTEM_CLOCK_MULTIPLIER" } },
|
|
272
|
+
{ id: "aircraft", availability: "2025-06-15T00:00:00Z/2025-06-15T06:00:00Z",
|
|
273
|
+
position: { epoch: "2025-06-15T00:00:00Z",
|
|
274
|
+
cartographicDegrees: [0,-75,40,10000, 10800,-88,42,11000, 21600,-118,34,9000],
|
|
275
|
+
interpolationAlgorithm: "LAGRANGE", interpolationDegree: 5 },
|
|
276
|
+
point: { pixelSize: 10, color: { rgba: [255,255,0,255] } } },
|
|
277
|
+
];
|
|
278
|
+
const ds = await CzmlDataSource.load(czml);
|
|
279
|
+
const viewer = new Viewer("cesiumContainer", { shouldAnimate: true });
|
|
280
|
+
viewer.dataSources.add(ds);
|
|
281
|
+
viewer.zoomTo(ds);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## EasingFunction -- Camera Flight Curves
|
|
285
|
+
|
|
286
|
+
Constants for `camera.flyTo` timing (not Property interpolation). Common values: `LINEAR_NONE`, `CUBIC_IN_OUT`, `QUADRATIC_IN_OUT`. Full set includes `QUARTIC`, `QUINTIC`, `SINUSOIDAL`, `EXPONENTIAL`, `CIRCULAR`, `ELASTIC`, `BACK`, `BOUNCE` variants (each with `_IN`, `_OUT`, `_IN_OUT`).
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
import { EasingFunction, Cartesian3 } from "cesium";
|
|
290
|
+
viewer.camera.flyTo({
|
|
291
|
+
destination: Cartesian3.fromDegrees(-75, 40, 50000),
|
|
292
|
+
duration: 3.0,
|
|
293
|
+
easingFunction: EasingFunction.CUBIC_IN_OUT,
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Putting It Together: Animated Flight
|
|
298
|
+
|
|
299
|
+
Combines Clock, SampledPositionProperty, VelocityOrientationProperty, and availability.
|
|
300
|
+
|
|
301
|
+
```js
|
|
302
|
+
import {
|
|
303
|
+
Viewer, JulianDate, ClockRange, SampledPositionProperty, VelocityOrientationProperty,
|
|
304
|
+
TimeIntervalCollection, TimeInterval, Cartesian3, LagrangePolynomialApproximation,
|
|
305
|
+
} from "cesium";
|
|
306
|
+
|
|
307
|
+
const viewer = new Viewer("cesiumContainer", { shouldAnimate: true });
|
|
308
|
+
const start = JulianDate.fromIso8601("2025-06-15T16:00:00Z");
|
|
309
|
+
const stop = JulianDate.addSeconds(start, 360, new JulianDate());
|
|
310
|
+
viewer.clock.startTime = start.clone();
|
|
311
|
+
viewer.clock.stopTime = stop.clone();
|
|
312
|
+
viewer.clock.currentTime = start.clone();
|
|
313
|
+
viewer.clock.clockRange = ClockRange.LOOP_STOP;
|
|
314
|
+
viewer.clock.multiplier = 10;
|
|
315
|
+
viewer.timeline.zoomTo(start, stop);
|
|
316
|
+
|
|
317
|
+
const position = new SampledPositionProperty();
|
|
318
|
+
for (let i = 0; i <= 360; i += 45) {
|
|
319
|
+
const r = (i * Math.PI) / 180;
|
|
320
|
+
position.addSample(JulianDate.addSeconds(start, i, new JulianDate()),
|
|
321
|
+
Cartesian3.fromDegrees(-112 + 0.045 * Math.cos(r), 36 + 0.03 * Math.sin(r), 2000));
|
|
322
|
+
}
|
|
323
|
+
position.setInterpolationOptions({ interpolationDegree: 5, interpolationAlgorithm: LagrangePolynomialApproximation });
|
|
324
|
+
|
|
325
|
+
viewer.trackedEntity = viewer.entities.add({
|
|
326
|
+
availability: new TimeIntervalCollection([new TimeInterval({ start, stop })]),
|
|
327
|
+
position, orientation: new VelocityOrientationProperty(position),
|
|
328
|
+
model: { uri: "aircraft.glb", minimumPixelSize: 64 },
|
|
329
|
+
path: { resolution: 1, width: 10 },
|
|
330
|
+
});
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Performance Tips
|
|
334
|
+
|
|
335
|
+
1. Prefer `SampledPositionProperty` over `CallbackProperty` for positions -- binary search is faster than per-frame callbacks.
|
|
336
|
+
2. Keep `interpolationDegree` at 5 or below; higher risks Runge's phenomenon with sparse data.
|
|
337
|
+
3. Reuse `JulianDate` result parameters in loops to avoid GC pressure.
|
|
338
|
+
4. Set entity `availability` to cull entities outside the current time window.
|
|
339
|
+
5. In `CallbackProperty`, return the `result` object to avoid allocations.
|
|
340
|
+
6. Load bulk temporal data via `CzmlDataSource` -- optimized for batch sample insertion.
|
|
341
|
+
7. Use `ExtrapolationType.HOLD` instead of duplicate trailing samples.
|
|
342
|
+
8. Use `ClockStep.TICK_DEPENDENT` for deterministic replay; `SYSTEM_CLOCK_MULTIPLIER` varies with frame rate.
|
|
343
|
+
9. Minimize `CallbackProperty` count -- each runs its function every frame.
|
|
344
|
+
|
|
345
|
+
## Key Enums
|
|
346
|
+
|
|
347
|
+
`ClockRange`: UNBOUNDED, CLAMPED, LOOP_STOP. `ClockStep`: TICK_DEPENDENT, SYSTEM_CLOCK_MULTIPLIER, SYSTEM_CLOCK. `ExtrapolationType`: NONE, HOLD, EXTRAPOLATE. `TimeStandard`: UTC, TAI. `ReferenceFrame`: FIXED, INERTIAL. `TrackingReferenceFrame` (v1.124+): AUTODETECT, ECI, ECEF, INERTIAL, ENU.
|
|
348
|
+
|
|
349
|
+
## See Also
|
|
350
|
+
|
|
351
|
+
- **cesiumjs-entities** -- Entity, Graphics types, DataSources (consumers of properties)
|
|
352
|
+
- **cesiumjs-viewer-setup** -- Viewer, ClockViewModel, Timeline widget
|
|
353
|
+
- **cesiumjs-models-particles** -- Model, ModelAnimation (uses time system for playback)
|