代码
const map = new BMap.Map('map');
map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
map.enableScrollWheelZoom(true);
const marker = new BMap.Marker(new BMap.Point(116.404844, 39.921354));
map.addOverlay(marker);

const times = ['2008-01-01', '2015-01-02', '2020-01-03', '2024-01-04'];
const timeline = new BMapLib.Timeline({
  map,
  times,
});

const points = [
  new BMap.Point(116.341028, 39.94083),
  new BMap.Point(116.308833, 39.92224),
  new BMap.Point(116.459461, 39.854476),
  new BMap.Point(116.430715, 39.932863),
];
timeline.on('change', function (e) {
  const idx = times.indexOf(e.time);
  const point = points[idx];
  if (point) {
    marker.setPosition(point);
  }
});
预览