cesiumgs/cesiumjs-skills/cesiumjs-time-properties

Claude Code and agent skill by cesiumgs/cesiumjs-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

CesiumJS time, properties, and animation - Clock, JulianDate, TimeInterval, Property, SampledProperty, CallbackProperty, PathMode, interval and sampled path materials, interpolation, splines, CZML temporal data. Use when making entity attributes or path materials time-dynamic, configuring the simulation clock, interpolating positions, or working with sampled, interval, or callback properties.

Install

npx vskill@latest install cesiumgs/cesiumjs-skills/cesiumjs-time-properties

SKILL.md

CesiumJS Time, Properties & Animation

Version baseline: CesiumJS v1.144

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.

JulianDate -- The Time Primitive

Stores whole days + fractional seconds separately for precision. Always uses TAI internally.

js
import { JulianDate } from "cesium";
// Creation: fromIso8601 (most common), fromDate, now
const date = JulianDate.fromIso8601("2025-06-15T12:00:00Z");
const jd = JulianDate.fromDate(new Date("2025-06-15T12:00:00Z"));
const now = JulianDate.now();
// Conversion: toIso8601, toDate, toGregorianDate
const iso = JulianDate.toIso8601(date); // "2025-06-15T12:00:00Z"
const greg = JulianDate.toGregorianDate(date); // {year, month, day, hour, ...}
// Arithmetic -- all require a result parameter to avoid allocations
const r = new JulianDate();
JulianDate.addSeconds(date, 3600, r); // also: addMinutes, addHours, addDays
// Differences and comparisons
const stop = JulianDate.addHours(date, 24, new JulianDate());
JulianDate.secondsDifference(stop, date); // 86400
JulianDate.lessThan(date, stop); // true
JulianDate.compare(date, stop); // negative (date < stop)

Clock -- Simulation Time Controller

The Viewer creates a Clock automatically. Configure it to control playback speed and bounds.

js
import { Viewer, JulianDate, ClockRange, ClockStep } from "cesium";
const viewer = new Viewer("cesiumContainer");
const start = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
const stop = JulianDate.addHours(start, 24, new JulianDate());
viewer.clock.startTime = start.clone();
viewer.clock.stopTime = stop.clone();
viewer.clock.currentTime = start.clone();
viewer.clock.clockRange = ClockRange.LOOP_STOP; // loop at end
viewer.clock.multiplier = 60; // 60x real-time
viewer.clock.shouldAnimate = true;
viewer.timeline.zoomTo(start, stop);
// Per-frame callback: compute a [0,1] fraction for camera or property animation
viewer.clock.onTick.addEventListener((clock) => {
const elapsed = JulianDate.secondsDifference(clock.currentTime, clock.startTime);
const total = JulianDate.secondsDifference(clock.stopTime, clock.startTime);
const t = Math.max(0, Math.min(1, elapsed / total));
// Example: interpolate camera position linearly between two points
// const dest = Cartesian3.lerp(startPos, endPos, t, new Cartesian3());
// viewer.camera.setView({ destination: dest, orientation: { heading: 0, pitch: CesiumMath.toRadians(-30), roll: 0 } });
});

Manual clock advancement -- call viewer.clock.tick() to advance the clock by one frame outside the render loop (useful for setting up a mid-interval state before a screenshot):

js
// Advance to midpoint before screenshot
viewer.clock.currentTime = JulianDate.addSeconds(start, 15, new JulianDate());
viewer.clock.tick(); // fires onTick listeners immediately
ClockRangeBehavior
UNBOUNDEDAdvances forever in both directions
CLAMPEDStops at start/stop time
LOOP_STOPWraps from stop back to start
ClockStepBehavior
TICK_DEPENDENTEach tick advances by multiplier seconds (frame-dependent)
SYSTEM_CLOCK_MULTIPLIERElapsed wall time x multiplier (default)
SYSTEM_CLOCKReal-time; ignores multiplier

TimeInterval & TimeIntervalCollection

js
import { TimeInterval, TimeIntervalCollection, JulianDate } from "cesium";
const interval = TimeInterval.fromIso8601({
iso8601: "2025-06-15T00:00:00Z/2025-06-16T00:00:00Z",
data: { phase: "daylight" }, // attach arbitrary data
});
TimeInterval.contains(interval, JulianDate.fromIso8601("2025-06-15T12:00:00Z")); // true
// Used by Entity.availability to cull entities outside the time window
const availability = new TimeIntervalCollection([
new TimeInterval({
start: JulianDate.fromIso8601("2025-06-15T00:00:00Z"),
stop: JulianDate.fromIso8601("2025-06-16T00:00:00Z"),
}),
]);

Property System -- Time-Varying Values

Every entity attribute is a Property. CesiumJS calls property.getValue(time) each frame.

ConstantProperty

Returns the same value regardless of time. CesiumJS auto-wraps raw values, so explicit use is rare.

js
import { ConstantProperty, Color } from "cesium";
const prop = new ConstantProperty(Color.RED);
prop.setValue(Color.BLUE); // fires definitionChanged
SampledProperty -- Interpolated Time Series

Stores discrete samples and interpolates. Type can be Number, Cartesian3, Color, or any Packable.

js
import { SampledProperty, JulianDate, LagrangePolynomialApproximation, ExtrapolationType } from "cesium";
const prop = new SampledProperty(Number);
const t0 = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
prop.addSample(t0, 1.0);
prop.addSample(JulianDate.addSeconds(t0, 60, new JulianDate()), 2.5);
prop.addSample(JulianDate.addSeconds(t0, 120, new JulianDate()), 1.0);
prop.getValue(JulianDate.addSeconds(t0, 30, new JulianDate())); // ~1.75
// Default: LinearApproximation degree 1. Switch to smoother Lagrange:
prop.setInterpolationOptions({ interpolationDegree: 5, interpolationAlgorithm: LagrangePolynomialApproximation });
prop.forwardExtrapolationType = ExtrapolationType.HOLD; // hold last value outside range
SampledPositionProperty -- Interpolated Positions

Specialized for Cartesian3 positions. Supports reference frames (ReferenceFrame.FIXED default, or INERTIAL).

js
import { SampledPositionProperty, JulianDate, Cartesian3, LagrangePolynomialApproximation, ExtrapolationType } from "cesium";
const position = new SampledPositionProperty();
const start = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
for (let i = 0; i <= 360; i += 45) {
const rad = (i * Math.PI) / 180;
position.addSample(
JulianDate.addSeconds(start, i, new JulianDate()),
Cartesian3.fromDegrees(-112 + 0.045 * Math.cos(rad), 36 + 0.03 * Math.sin(rad), 2000 + Math.random() * 500),
);
}
position.setInterpolationOptions({ interpolationDegree: 5, interpolationAlgorithm: LagrangePolynomialApproximation });
position.forwardExtrapolationType = ExtrapolationType.HOLD;

For screenshot or evaluation scenes, a sampled path alone is often not enough. Add an obvious marker to the same moving entity (point, billboard, or model) so the current sample is recognizable at the clock's currentTime.

js
import { Color } from "cesium";
const aircraft = viewer.entities.add({
position,
point: {
pixelSize: 14,
color: Color.CYAN,
outlineColor: Color.BLACK,
outlineWidth: 2,
disableDepthTestDistance: Number.POSITIVE_INFINITY,
},
path: {
width: 4,
leadTime: 180,
trailTime: 180,
material: Color.YELLOW,
},
});
AlgorithmBest ForDegree
LinearApproximationFast piecewise-linear1 (fixed)
LagrangePolynomialApproximationSmooth curves from sparse samples1--9
HermitePolynomialApproximationSmooth curves with velocity derivatives1--9
CallbackProperty -- Computed on Demand

Evaluates a function every frame. Second argument (isConstant) must be false if value changes.

js
import { CallbackProperty, Color, JulianDate } from "cesium";
// Pulsing alpha via sine wave
const startTime = JulianDate.now();
const pulse = new CallbackProperty((time, result) => {
const s = JulianDate.secondsDifference(time, startTime);
return Color.RED.withAlpha(0.5 + 0.5 * Math.sin(s * 2), result ?? new Color());
}, false);
// Hue cycling -- full color wheel every `period` seconds using Color.fromHsl
// Color.fromHsl(hue 0-1, saturation 0-1, lightness 0-1, alpha 0-1, result?)
const period = 8; // seconds per full cycle
const hueCycle = new CallbackProperty((time, result) => {
const s = JulianDate.secondsDifference(time, viewer.clock.startTime);
const hue = (s % period) / period;
return Color.fromHsl(hue, 0.8, 0.5, 0.8, result ?? new Color());
}, false);
// Use as: polygon.material = new ColorMaterialProperty(hueCycle);
// Growing polygon -- mutate the array, property auto-updates
const pts = [/* initial Cartesian3[] */];
const dynamicPts = new CallbackProperty(() => pts, false);
CompositeProperty -- Stitching Properties Over Time

Delegates to different sub-properties for different time ranges. Each interval's data is a Property.

js
import { CompositeProperty, ConstantProperty, SampledProperty, TimeInterval, JulianDate } from "cesium";
const composite = new CompositeProperty();
composite.intervals.addInterval(TimeInterval.fromIso8601({
iso8601: "2025-06-15T00:00:00Z/2025-06-15T12:00:00Z", data: new ConstantProperty(1.0) }));
const sampled = new SampledProperty(Number);
sampled.addSample(JulianDate.fromIso8601("2025-06-15T12:00:00Z"), 1.0);
sampled.addSample(JulianDate.fromIso8601("2025-06-16T00:00:00Z"), 5.0);
composite.intervals.addInterval(TimeInterval.fromIso8601({
iso8601: "2025-06-15T12:00:00Z/2025-06-16T00:00:00Z", isStartIncluded: false, data: sampled }));
VelocityOrientationProperty -- Auto-Orient Along Path

Computes Quaternion from a position property's velocity. Essential for vehicles and aircraft.

js
import { VelocityOrientationProperty, SampledPositionProperty } from "cesium";
const position = new SampledPositionProperty();
// ... add samples ...
viewer.entities.add({
position, orientation: new VelocityOrientationProperty(position),
model: { uri: "aircraft.glb", minimumPixelSize: 64 },
});

For robust visual recognition, do not rely only on an external model URI unless the asset is guaranteed to load. Pair the model with a point or billboard marker when the prompt expects the aircraft/satellite/vehicle itself to be visible.

ReferenceProperty -- Cross-Entity Binding

Links one entity's property to another by ID string ("entityId#propertyPath").

js
import { ReferenceProperty } from "cesium";
viewer.entities.add({ id: "leader", position: Cartesian3.fromDegrees(-75, 40, 1000) });
viewer.entities.add({ id: "follower",
position: ReferenceProperty.fromString(viewer.entities, "leader#position"),
point: { pixelSize: 10 } });

This is useful after loading CZML: keep the CZML-driven path in the data source, then add a normal viewer entity marker whose position references the CZML entity. That makes the current subject visible and easy to inspect without duplicating samples.

Material Properties

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.

js
import { ColorMaterialProperty, SampledProperty, Color, JulianDate } from "cesium";
const solid = new ColorMaterialProperty(Color.RED);
// Time-varying color via SampledProperty
const colorProp = new SampledProperty(Color);
const t0 = JulianDate.fromIso8601("2025-06-15T00:00:00Z");
colorProp.addSample(t0, Color.BLUE);
colorProp.addSample(JulianDate.addHours(t0, 6, new JulianDate()), Color.RED);
const animated = new ColorMaterialProperty(colorProp);

Segmented Path Materials (1.143+)

PathMode.WHOLE preserves the original behavior: the material evaluated at the current simulation time colors the entire visible path. Use PathMode.PORTIONS to keep past and future path portions colored by the material at each portion's time.

Prefer interval materials for discrete phases because Cesium splits only at the interval boundaries:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
75
Repository forks
10
7-day trend score
22

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 28 May 2026, 5 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cesiumgs/cesiumjs-skills/cesiumjs-time-properties/badge)](https://verified-skill.com/skills/cesiumgs/cesiumjs-skills/cesiumjs-time-properties)

Something wrong with this skill or its page? Tell us.