Cesium entity 渐隐渐显、闪烁

 点entity

function f2(){
	var x=1;var flog=true;//闪烁
    //var x=0;var flog=false;//渐显
	viewer.entities.add({
		name:"圆点point闪烁",
		position:Cesium.Cartesian3.fromDegrees(116.20+0.03,39.53+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
		}
	});
}

面entity 

function f1() {
    var x = 1;
    var flog = true;
    viewer.entities.add({
        name: "圆形区域闪烁",
        position: Cesium.Cartesian3.fromDegrees(116.20, 39.53, 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;
                    }
                }
                console.log(x)
                return Cesium.Color.RED.withAlpha(x);
            }, false))
        }
    });
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值