一条普通的线有时候业务中无法满足我们的需求,我们需要流动,旋转,扩散等等;
那么现在我们绘制一条流动的线。最后效果就是下面流动起来的样子
// 首先创建装载矢量数据的矢量图层
const graphicLayer = new mars3d.layer.GraphicLayer()
map.addLayer(graphicLayer)
// 绘制线
const graphic = new mars3d.graphic.PolylineEntity({
positions: [
[117.037815, 31.799497, 39.1],
[117.097695, 31.742135, 22.5]
],
style: {
width: 18,
// 材质,主要是靠material来绘制流动的效果,image就是流动的图片,
material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow,{
color: "#a6d96a",
repeat: new Cesium.Cartesian2(4.0, 1.0), // 横纵方向重复的次数
image: "img/arrow_1.png",
speed: 20 // 流动的速度
})
}
})
graphicLayer.addGraphic(graphic)