Skip to content

Commit

Permalink
更新 timeline README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
L-hikari authored Aug 30, 2024
1 parent 90686a1 commit 3471744
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Timeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
const marker = new BMapGL.Marker(new BMapGL.Point(116.404844, 39.921354));
map.addOverlay(marker);

const times = [
'2024-01-01',
'2024-01-02',
'2024-01-03',
'2024-01-04',
];
const timeline = new BMapGLLib.Timeline({
map,
times: [
'2024-01-01',
'2024-01-02',
'2024-01-03',
'2024-01-04',
]
times,
});

const points = [
Expand All @@ -19,11 +20,12 @@
new BMapGL.Point(116.459461,39.854476),
new BMapGL.Point(116.430715,39.932863),
];
let index = 0;

timeline.on('change', e => {
console.log(e);
marker.setPosition(points[index++]);
const point = points[times.indexOf(e.time)];
console.log(point);
marker.setPosition(point);
});
```

Expand Down

0 comments on commit 3471744

Please sign in to comment.