我如何知道 olext 动画何时结束?

How do I know when an olext animation has ended?

我使用 Openlayers 和 olext 制作了一个动画。

var f = new ol.Feature (new ol.geom.Point(coord));
  f.setStyle (new ol.style.Style({
    image: new ol.style.Circle({
      radius: 18, 
      points: 10,
      stroke: new ol.style.Stroke ({ color: "rgba(0,0,0,1)", width:3 })
    })
  }));
  map.animateFeature(f, new ol.featureAnimation.Zoom({
    fade: ol.easing.easeOut, 
    duration: 1300, 
    easing: ol.easing["easeOut"] 
  }));

但是我不知道动画什么时候结束

有动画结束事件吗?

我想在一个动画完成之前避免重复动画。

文档说有一个 animationend 事件 https://viglino.github.io/ol-ext/doc/doc-pages/ol.featureAnimation.html

  var animation = new ol.featureAnimation.Zoom({
    fade: ol.easing.easeOut, 
    duration: 1300, 
    easing: ol.easing["easeOut"] 
  });

  animation.on('animationend', function(){
    console.log('animationend');
  });

  map.animateFeature(f, animation);

正如@Mike 所说,有一个 animationend 事件。
您还可以测试动画是否正在播放或停止:

var anim = map.animateFeature(f, animation);
if (anim.isPlaying()) {
  anim.stop();
}