There are different ways of defining the movement of an object, both on the *conceptual* level and on the *implementation* level.

I would be perfect if I can assign speed value and say head to the destination at 300 km/r or reach the destination within 3 minutes.

These are two different ways on the *conceptual* level. You can say that an object should move in a certain direction, for 1 hour, with 300km/h, or you could say that an object should move from a start position to an end position that is 300km away, and this should take 1 hour.

In the most simple case, the result will be the same (and that may sound obvious). But depending on your use case, there may be details that are relevant. For example, imagine that you either have

- an Excel table that contains entries like
`timeStamp, position`

- an Excel table that contains entries like
`timeStamp, velocityVector`

You can convert them into each other, but depending on your input data and the goal, one approach may be easier than the other.

(This does not cover the *real* details. Imagine you want to “model” the behavior of a truck that moves 100km/h in one hour. In reality, it will *not* move with a constant speed. It will accelerare in the beginning, and stop at the end, and maybe drive faster than 100km/h in-between…)

However, focussing on the first steps towards a solution:

I tried looking at the time-dynamic features sandcastle. It is pretty close but not exactly what I want. In the time dynamic wheels demo, the truck accelerates from zero to 100 gradually. I would like to make it move with a constant speed.

In terms of the *implementation*: The example uses a `SampledPositionProperty`

. This basically corresponds to the `timeStamp, position`

Excel table that I mentioned above. You can define *at which point in time* the object should have *which position*, and CesiumJS will take care of moving the object.

And … you can throw *anything* into this `SampledPositionProperty`

. In the *Time-Dynamic Wheels* sandcastle, it is filled with some “dummy data” to simulate the acceleration, at

```
// Lerp using a non-linear factor so that the vehicle accelerates.
const locationFactor = Math.pow(factor, 2);
```

This causes it to start at 0, and then accelerate exponentially. You just change this line to use a constant factor. For example, if you want a constant speed, then you can compute a `speedFactor`

like this…

```
const desiredSpeedKmh = 45;
const distance = Cesium.Cartesian3.distance(startPosition, endPosition);
const metersPerSecond = (distance/totalSeconds);
const kilometersPerHour = metersPerSecond * (3600 / 1000);
const speedFactor = (desiredSpeedKmh / kilometersPerHour);
```

before the loop, and **in** the loop just set

`const locationFactor = factor * speedFactor;`

Then the truck will move with a constant speed of 45km/h.

You can see that this is computed based on the `startPosition`

, `endPosition`

, and the `totalSeconds`

that the animation will take. From different input data, you could compute the appropriate positions for the `SampledPositionProperty`

in a different way.