1.首先需要创建一个矢量数据图层
// 创建矢量数据图层
const graphicLayer = new mars3d.layer.GraphicLayer()
map.addLayer(graphicLayer)
2.配置飞机模型相关属性
const graphic = new mars3d.graphic.ModelEntity({
name: "飞机",
position: [116.239918, 30.879709, 1208],
style: {
url: "//data.mars3d.cn/gltf/mars/feiji.glb",
scale: 2
}
})
graphicLayer.addGraphic(graphic)
3.配置飞机模型运动效果
// 开始 自旋转效果
graphic.rotateStart({
direction: false, // 控制方向, true逆时针,false顺时针
time: 30 // time:给定飞行一周所需时间(单位 秒),控制速度
})
就是这么简单,想让你的网页炫酷又实用,随时可以参观mars-3d官网(mars-3d)哦!