根据状态修改圆锥扩散材质并实现扩散效果【Mars3d】
相关链接:
http://mars3d.cn/editor-vue.html?key=ex_6_3_3&id=graphic/entity/cylinder
相关代码:
function addDemoGraphic1(graphicLayer) {
const point = new mars3d.LngLatPoint(116.504297, 30.924326, 9000)
// 添加模型
const graphicModel = new mars3d.graphic.ModelEntity({
position: point,
style: {
url: "//data.mars3d.cn/gltf/mars/feiji.glb",
scale: 1,
minimumPixelSize: 50
},
attr: { remark: "示例6" }
})
graphicLayer.addGraphic(graphicModel)
// 效果1
const pointQY = point.clone()
pointQY.alt = pointQY.alt / 2
const graphic = new mars3d.graphic.CylinderEntity({
position: pointQY,
id: "bobo",
style: {
length: point.alt,
topRadius: 0.0,
bottomRadius: 2000,
materialType: mars3d.MaterialType.CircleWave,
materialOptions: {
color: "#ffff00",
repeat: 30.0,
thickness: 0.2
}
}
})
graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
setTimeout(() => {
const cc = graphicLayer.getGraphicById("bobo")
cc.setStyle({
materialType: mars3d.MaterialType.CylinderWave,
materialOptions: {
color: "#ffff00",
repeat: 30.0,
thickness: 0.2
}
})
}, 6000)
}