cesium鼠标移入实体动态加亮

 var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
                    handler.setInputAction(function(movement){
                        var haveEn = viewer.scene.pick(movement.endPosition);
                        if(viewer.scene.pickPositionSupported && Cesium.defined(haveEn) && haveEn.id !== ' '){
                            clearAlpha();
                            if(haveEn.id.polygon !== undefined){
                               var haveEnsNow = haveEn.id.polygon._material._color.getValue();
                               haveEnsNow.alpha = 1;
                               haveEn.id.polygon._material._color.setValue(haveEnsNow);
                            }
                        }else if(haveEn == undefined){
                            clearAlpha();
                        }
                    },Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                    function clearAlpha(){
                        for(var i=0;i<viewer.entities.values.length;i++){
                            if(viewer.entities.values[i].name == "yanse"){
                                var haveEnsLast=viewer.entities.values[i]._polygon._material._color.getValue();
                                haveEnsLast.alpha = 0.2;
                                viewer.entities.values[i]._polygon._material._color.setValue(haveEnsLast)
                            }
                        }
                    }

本文转自 https://blog.csdn.net/weixin_42476786/article/details/99540957?spm=1001.2014.3001.5501,如有侵权,请联系删除。

上一篇:Linux中的基本概念:内核和shell


下一篇:Unity命令行打包WebGL