<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>三维特效集合</title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
    <style>
        body {
            margin: 0;
            padding: 0;
        }
        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }
    </style>
    <script src="./dist/js/Fun.js"></script>
    <script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.1.1/mapmost-webgl-min.js"></script>
    <script src="../example_data/flowLine_data.js"></script>
</head>
<body>
<div id="map"></div>
<script>
    let map = new mapmost.Map({
        container: 'map',  
        style: "<your style url>", 
        center: [120.71832572622088, 31.317901031136927], 
        zoom: 15.7, 
        pitch: 60, 
        bearing: 0, 
        userId: '***', 
        env3D:{
            envMap: "../example_data/hdr/WhiteBG_Ref_1K.hdr",
            exposure: 0.7,
        }
    });
    map.on('load', function () {
        let models_obj = ["../example_data/sz_buildings.glb"].map(item => ({
            type: 'glb',
            url: item
        }));
        let options = {
            id: 'model_id',
            type: 'model',
            models: models_obj,
            project: "3857",
            center: [120.71755968678801, 31.32662823446909, 0],
            callback: function (group, layer) {
                
                layer.addModelEffect(group, [
                    {
                        type: "gradient",
                        startColor: "#83afff",
                        endColor: "#FFFFFF",
                        percent: 0.2
                    }
                    , {
                        type: "flow",
                        speed: 1,
                        color: "#339bf6",
                        percent: 0.05
                    }
                ])
                
                let sphere = layer.addSphere({
                    color: "#ff0000",
                    radius: 3300, 
                    wSegment: 64,
                    hSegment: 64,
                    phiLength: 180,
                    speed: 3,
                    opacity: 0.8,
                    center: [120.71755968678801, 31.32662823446909, 0.0]
                });
                
                let data_trail1 = getBSRPoints(120.71541557869517, 31.316503949907542, 120.73787560336916, 31.321925190347713, 800);
                let data_trail2 = getBSRPoints(120.71541557869517, 31.316503949907542, 120.72619950480242, 31.33360076088249, 1500);
                let data_trail3 = getBSRPoints(120.71541557869517, 31.316503949907542, 120.69933418653403, 31.332725809914024, 900);
                [data_trail1, data_trail2, data_trail3].map(data => {
                    layer.addFlowLine({
                        type: "trail",
                        color: '#0000ff',
                        speed: 4,
                        opacity: 0.6,
                        width: 6,
                        data: {
                            coordinate: data
                        }
                    });
                })
                flow_data.map(data => {
                    layer.addFlowLine({
                        type: "flow",
                        color: '#ff680d',
                        speed: 2,
                        opacity: 1,
                        percent: 0.08,
                        gradient: 0.02,
                        width: 5,
                        data: {
                            coordinate: data
                        }
                    });
                })
            }
        };
        map.addLayer(options);
    })
</script>
</body>
</html>