Skip to content

Commit a28e9cb

Browse files
committed
Update Animate along a route path.html
1 parent ca72c08 commit a28e9cb

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Samples/Animations/Animate along a route path/Animate along a route path.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
//Create an array of point features with timestamp information to define a route to animate along.
2727
//To animate a route, there must be a _timestamp property that has a value from Date.getTime().
2828
var routePoints = [
29-
new atlas.data.Feature(new atlas.data.Point([-122.34758, 47.62155]), { _timestamp: new Date('Tue, 18 Aug 2020 00:53:53 GMT').getTime() }),
30-
new atlas.data.Feature(new atlas.data.Point([-122.34764, 47.61859]), { _timestamp: new Date('Tue, 18 Aug 2020 00:54:53 GMT').getTime() }),
31-
new atlas.data.Feature(new atlas.data.Point([-122.33787, 47.61295]), { _timestamp: new Date('Tue, 18 Aug 2020 00:56:53 GMT').getTime() }),
32-
new atlas.data.Feature(new atlas.data.Point([-122.34217, 47.60964]), { _timestamp: new Date('Tue, 18 Aug 2020 00:59:53 GMT').getTime() })
29+
new atlas.data.Feature(new atlas.data.Point([-122.34758, 47.62155]), { timestamp: new Date('Tue, 18 Aug 2020 00:53:53 GMT').getTime() }),
30+
new atlas.data.Feature(new atlas.data.Point([-122.34764, 47.61859]), { timestamp: new Date('Tue, 18 Aug 2020 00:54:53 GMT').getTime() }),
31+
new atlas.data.Feature(new atlas.data.Point([-122.33787, 47.61295]), { timestamp: new Date('Tue, 18 Aug 2020 00:56:53 GMT').getTime() }),
32+
new atlas.data.Feature(new atlas.data.Point([-122.34217, 47.60964]), { timestamp: new Date('Tue, 18 Aug 2020 00:59:53 GMT').getTime() })
3333
];
3434

3535
function GetMap() {
@@ -119,10 +119,13 @@
119119
pin = new atlas.Shape(routePoints[0]);
120120
pinSource.add(pin);
121121

122+
//Extract timestamp information from a custom property of the point features.
123+
//By default the `moveAlongRoute` function looks for a `_timestamp` property on the point features that is a Date.getTime() value.
124+
//If your points already have a `_timestamp` property with the correct value type, you can skip this extraction step.
125+
routePoints = atlas.animations.extractRoutePoints(route, 'timestamp');
126+
122127
//Create the animation.
123128
animation = atlas.animations.moveAlongRoute(routePoints, pin, {
124-
//Specify the property that contains the timestamp.
125-
timestampProperty: 'timestamp',
126129

127130
//Capture metadata so that data driven styling can be done.
128131
captureMetadata: true,

0 commit comments

Comments
 (0)