openlayers - 我如何知道 olext 动画何时结束?
问题描述
我使用 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);
推荐阅读
- javascript - 比较同一对象中的 2 个数组键和值
- c++ - 有没有办法将无向图转换为 (x,y) 坐标系?
- amazon-web-services - AWS Amplify - Cognito,如何知道我的用户有权执行某些操作?
- python - 使用 Python 从新闻网站上抓取评论。将评论隐藏在“显示更多”下的问题
- r - 你能用只有一个水平的自变量在 r 中进行线性回归吗?
- laravel - 多个文件输入类型覆盖选定的文件并仅上传最后一个选定的文件
- kotlin - Kotlin:运算符“!=”不能应用于“字符串?” 和'Char.Companion'
- arrays - 将文件逐行读入C中的字符串数组
- leaflet - 使用folium设置地图ID?
- operating-system - 获取 Windows 版本