Files
sdk4_demo/example/水柱.html

81 lines
2.2 KiB
HTML
Raw Normal View History

2025-07-03 15:12:58 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- <script src="https://cesium.com/downloads/cesiumjs/releases/1.96/Build/Cesium/Cesium.js"></script> -->
<script src="../sdk/YJEarth.min.js"></script>
<script src="vue.js"></script>
<style>
body {
width: 100%;
height: 100%;
margin: 0;
}
#app {
width: 100%;
height: 100vh;
}
</style>
</head>
<body>
<div id="app" class="fullSize">
</div>
</body>
</html>
<script>
new Vue({
el: "#app",
data: {
sdk: null,
Flame: null,
Smoke: null,
Fountain: null
},
async mounted() {
await YJ.on()
await this.createEarth()
await this.addFlame()
},
methods: {
async createEarth() {
this.sdk = await new YJ.YJEarth("app")
let openLeftClick = await new YJ.Global.openLeftClick(this.sdk)
let openRightClick = await new YJ.Global.openRightClick(this.sdk)
let tileset = new YJ.Obj.Tileset(this.sdk, {
show: true,
url: "http://localhost:8891/yjearth4.0/data/tileset/6dee5cc84e66a61231e3a0048fd6c25a/tileset.json",
id: "123456",
position: { lng: 98.56452541, lat: 28.94328824, alt: 6218.71 },
})
await tileset.on()
tileset.flyTo()
},
addFlame() {
let Draw = new YJ.Draw.DrawPolyline(this.sdk, { number: 2 })
Draw.start((a, positions) => {
this.Fountain = new YJ.Obj.Spout(this.sdk, {
start: {
...positions[0]
},
end: {
...positions[1]
}
})
this.Fountain.edit(true)
// this.Fountain.flyTo()
window.Fountain = this.Fountain
console.log(this.Fountain)
})
}
}
})
</script>