Cesium-entiy閃爍范例


 // name:"圓閃爍",
    function f1() {
        var x=1;
        var flog=true;
        viewer.entities.add({
            name:"圓形區域閃爍",
            position:Cesium.Cartesian3.fromDegrees(lon,lat,0),
            ellipse : {
                semiMinorAxis : 2000.0,
                semiMajorAxis : 2000.0,
                height : 0,
                material:new Cesium.ColorMaterialProperty(new Cesium.CallbackProperty(function () {
                    if(flog){
                        x=x-0.05;
                        if(x<=0){
                            flog=false;
                        }
                    }else{
                        x=x+0.05;
                        if(x>=1){
                            flog=true;
                        }
                    }
                    return Cesium.Color.RED.withAlpha(x);
                },false))
            }
        });

    }f1();
    function f2(){
        var x=1;
        var flog=true;
        viewer.entities.add({
            name:"圓點point閃爍",
            position:Cesium.Cartesian3.fromDegrees(lon+0.03,lat+0.03,0),
            point : {
                show : true, // default
                color :new Cesium.CallbackProperty(function () {
                    if(flog){
                        x=x-0.05;
                        if(x<=0){
                            flog=false;
                        }
                    }else{
                        x=x+0.05;
                        if(x>=1){
                            flog=true;
                        }
                    }
                    return Cesium.Color.RED.withAlpha(x);
                },false),
                pixelSize : 10, // default: 1
                outlineWidth :0
            }
        });

    } f2();
    viewer.zoomTo(viewer.entities);

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM