简体   繁体   English

如何通过OpenLayers绘制动画线来说明两点之间的流动?

[英]How can I draw an animated line which illustrates flow between two points via OpenLayers?

I need to be able to illustrate water flowing from one point to another. 我需要能够说明水从一个点流到另一个点。

I have been trying to design a line similar to the progress bar from Bootstrap ( https://getbootstrap.com/docs/4.3/components/progress/#animated-stripes ) without luck. 我一直在尝试设计一条与Bootstrap( https://getbootstrap.com/docs/4.3/components/progress/#animated-stripes )的进度条类似的行,但是没有运气。 I have researched for quite a while and not able to find a way or extension which were able to solve my problem. 我已经研究了很长时间,却找不到能够解决我的问题的方法或扩展。

I am therefore asking an OpenLayers export for help. 因此,我正在向OpenLayers出口寻求帮助。

You can do this by setting the line styles up in the following manner: 您可以通过以下方式设置线条样式来做到这一点:

  1. Draw a solid stroke/line 画一条线/线
  2. Draw a dashed stroke/line over the top with a smaller width 在顶部以较小的宽度绘制虚线 /线条
  3. On a timer, increment the lineDashOffset of the dashed line, which will give an animation effect 在计时器上,增加虚线的lineDashOffset,这将产生动画效果

Example here: https://stackblitz.com/edit/ol-line-animation 此处的示例: https : //stackblitz.com/edit/ol-line-animation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM