显示源代码
开场动画
 开发文档
            <!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <script src="/offline_data/newjunbiao//vue.js"></script>
        <link
            href="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/Widgets/widgets.css"
            rel="stylesheet"
        />
        <script src="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/bigemap-gl.js"></script>
        <!-- elementui -->
        <script src="/offline_data/newjunbiao/elementui.js"></script>
        <link rel="stylesheet" href="/offline_data/newjunbiao//elementui.css" />
        <title>开场动画</title>
        <style>
            * {
                margin: 0;
                padding: 0;
            }
            html,
            body {
                width: 100%;
                height: 100%;
            }
            #app {
                width: 100%;
                height: 100%;
            }
            #baseMap {
                width: 100%;
                height: 100%;
            }
            .tools {
                position: absolute;
                z-index: 9;
                top: 40px;
                right: 60px;
                width: 200px;
                height: 40px;
                display: flex;
                align-items: center;
                justify-content: right;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <div id="baseMap"></div>
            <div class="tools">
                <el-button type="success" size="small" @click="restartFly"
                    >重新开始飞行</el-button
                >
                <el-button type="danger" size="small" @click="pauseFly"
                    >停止镜头飞行</el-button
                >
            </div>
        </div>
        <script>
            window.viewer = null;
            window.onload = () => {
                new Vue({
                    el: "#app",
                    data() {
                        return {};
                    },
                    mounted() {
                        this.initMap();
                    },
                    methods: {
                        //初始化地图
                        initMap() {
                            //设置相机镜头默认位置
                            bmgl.Camera.DEFAULT_VIEW_RECTANGLE =
                                bmgl.Rectangle.fromDegrees(
                                    -141.006,
                                    83.117,
                                    -52.617,
                                    41.669
                                );
                            bmgl.Config.HTTP_URL =
                                "http://ua.bigemap.com:30081/bmsdk/";
                            viewer = new bmgl.Viewer("baseMap", {
                                mapId: "bigemap.dc-tian-w-satellite",
                                infoBox: false,
                                selectionIndicator: false,
                                requestRenderMode: false,
                            });
                            this.openFlyAnimation();
                        },
                        //开场动画
                        openFlyAnimation() {
                            viewer.camera.flyTo({
                                destination: bmgl.Cartesian3.fromDegrees(
                                    104.5,
                                    30,
                                    200000
                                ),
                                orientation: {
                                    heading: 0,
                                    pitch: bmgl.Math.toRadians(-60),
                                    roll: 0,
                                },
                                //设置飞行动画时间
                                duration: 6.0,
                                //飞行完成后的回调函数
                                complete: () => {
                                    console.log("飞行完成");
                                },
                                //停止飞行的回调函数
                                cancel: () => {
                                    console.log("飞行停止");
                                },
                            });
                        },
                        pauseFly() {
                            //如果飞行正在进行,取消当前的镜头飞行。镜头留在当前位置
                            viewer.camera.cancelFlight();
                        },
                        restartFly() {
                            //返回默认视角
                            viewer.camera.flyHome(0);
                            this.openFlyAnimation();
                        },
                    },
                    beforeDestroy() {
                        viewer.destroy();
                        viewer = null;
                    },
                });
            };
        </script>
    </body>
</html>