文章目录

  • 1.实现效果
  • 2.实现方法
    • 2.1调用
    • 2.2 库文件

Cesium实战系列文章总目录: 传送门

1.实现效果

2.实现方法

2.1调用

引入js文件后,直接调用即可,设置其名称、中心点坐标、颜色、半径和速度等参数即可。

// 线圈发光扩散
let scanLine1 = new Scanline(viewer, "scanLine1");
scanLine1.add([113.923, 22.536, 0], "#CE1374", 1200, 15);

2.2 库文件

参考gitee上开源代码

Effect类文件可参考上一篇博文:传送门

/*** 线圈发光效果* 包括发光材质scanlineMaterialProperty和类scanline.js*/// 线圈发光扩散效果
class Scanline extends Effect {constructor(viewer, id) {super(viewer, id)}change_duration(d) {super.change_duration(d)const curEntity = this.viewer.entities.getById(this.id)curEntity._ellipse._material.speed = d}add(position, color, maxRadius, speed, isedit = false) {super.add(position, color, maxRadius, speed, isedit)const _this = thisthis.viewer.entities.add({id: _this.id,position: Cesium.Cartesian3.fromDegrees(position[0],position[1],position[2]),ellipse: {semiMinorAxis: new Cesium.CallbackProperty(function(n) {return _this.maxRadius}, false),semiMajorAxis: new Cesium.CallbackProperty(function(n) {return _this.maxRadius}, false),material: new Cesium.ScanlineMaterialProperty(new Cesium.Color.fromCssColorString(color),speed),classificationType: Cesium.ClassificationType.BOTH,},})}
}function ScanlineMaterialProperty(color, speed) {this._definitionChanged = new Cesium.Event()this.color = color || Cesium.Color.YELLOWthis.speed = speed || 10
}Object.defineProperties(ScanlineMaterialProperty.prototype, {isConstant: {get: function() {return false},},definitionChanged: {get: function() {return this._definitionChanged},},color: Cesium.createPropertyDescriptor('color'),speed: Cesium.createPropertyDescriptor('speed'),
})ScanlineMaterialProperty.prototype.getType = function(_time) {return Cesium.Material.ScanlineType
}
ScanlineMaterialProperty.prototype.getValue = function(time,result
) {if (!Cesium.defined(result)) {result = {}}result.color = Cesium.Property.getValueOrClonedDefault(this._color,time,Cesium.Color.WHITE,result.color)result.speed = this.speedreturn result
}ScanlineMaterialProperty.prototype.equals = function(other) {const reData =this === other ||(other instanceof ScanlineMaterialProperty &&Cesium.Property.equals(this.color, other.color) &&Cesium.Property.equals(this.speed, other.speed))return reData
}
Cesium.ScanlineMaterialProperty = ScanlineMaterialProperty
Cesium.Material.ScanlineType = 'Scanline'
Cesium.Material.ScanlineSource = `uniform vec4 color;uniform float speed;float circle(vec2 uv, float r, float blur) {float d = length(uv) * 1.0; /* 2.0 */float c = smoothstep(r+blur, r, d);return c;}czm_material czm_getMaterial(czm_materialInput materialInput){czm_material material = czm_getDefaultMaterial(materialInput);vec2 st = materialInput.st - 0.5;material.diffuse = 2.8 * color.rgb;material.emission = vec3(0);float t = fract(czm_frameNumber * (11000.0 - speed) / 500000.0);float s = 0.3;float radius1 = smoothstep(.0, s, t) * 0.5;float alpha1 = circle(st, radius1, 0.01) * circle(st, radius1, -0.01);float alpha2 = circle(st, radius1, 0.01 - radius1) * circle(st, radius1, 0.01);float radius2 = 0.5 + smoothstep(s, 1.0, t) * 0.5;float alpha3 = circle(st, radius1, radius2 + 0.01 - radius1) * circle(st, radius1, -0.01);material.alpha = smoothstep(1.0, s, t) * (alpha1 + alpha2*0.1 + alpha3*0.1);material.alpha *= color.a ;return material;}`
Cesium.Material._materialCache.addMaterial(Cesium.Material.ScanlineType, {fabric: {type: Cesium.Material.ScanlineType,uniforms: {color: new Cesium.Color(1, 0, 0, 0.5),time: 0,speed: 10,},source: Cesium.Material.ScanlineSource,},translucent: function(t) {return true},
})

cesium实现线圈发光效果相关推荐

  1. php发光字体代码,CSS3怎么实现字体发光效果

    这次给大家带来CSS3怎么实现字体发光效果,CSS3实现字体发光效果的注意事项有哪些,下面就是实战案例,一起来看一下. 博客页面左上角的"猿来是勇者"文字已制作发光效果,分享方法如 ...

  2. android 闪烁发光动画,androidview动画发光效果在imageview上

    我正在开发一个应用程序,在我的主页上,我需要给徽标(imageview)提供发光和褪色效果动画我尝试了很多,但是找不到如何给出发光效果动画,我知道onclick事件的发光效果请帮我解决这个问题 提前致 ...

  3. android 控件发光_如何在android中的按钮周围制作动画/常量发光效果?

    的按钮有一个背景绘制的图像,我只是想拥有它周围的发光效果,使它有点与音乐播放 我已经搜查各地的多个线程共鸣,他们要么只是一个ImageView的,或在压制,或位图,所以不一定是我寻求 这里是我的按钮X ...

  4. Unity ShaderGraph图片发光效果

    Unity ShaderGraph图片发光效果 前言 发光效果(Glow) 原理 ShaderGraph 前言 发光的基本原理,如何给图片施加不同颜色的光 公式讲解部分参考10行代码搞定"热 ...

  5. webgl智慧楼宇发光效果算法系列之高斯模糊

    webgl智慧楼宇发光效果算法系列之高斯模糊 如果使用过PS之类的图像处理软件,相信对于模糊滤镜不会陌生,图像处理软件提供了众多的模糊算法.高斯模糊是其中的一种. 在我们的智慧楼宇的项目中,要求对楼宇 ...

  6. Cesium:实现卷帘效果

    Cesium:实现卷帘效果 卷帘效果简介 Cesium:卷帘效果实现 Cesium:实现思路 示例代码 卷帘效果简介 先上一个简动画预演一下.     但是如何介绍"卷帘效果"呢? ...

  7. Unity Shader Graph 制作Emission发光效果

    效果图: Graph中用到了一个重要的节点,Fresnel Effect菲涅尔效果,在画面渲染中菲涅尔效果是一种很实用的技术手段,在Unity中则经常用它来实现边缘照明. 模型用到的依然是Asset ...

  8. Cesium实现雷达扫描效果

    Cesium实现雷达扫描效果 效果: html: <div id="cesiumContainer"></div> <canvas id=" ...

  9. Cesium雨雪雾天气效果

    Cesium雨雪雾天气效果 实现效果 关键代码 //雪着色器getSnow_fs() {return 'uniform sampler2D colorTexture;\n' +'varying vec ...

最新文章

  1. [iOS]开发者证书和描述文件的作用
  2. 从创业到成功,SaaS巨头Salesforce靠的是这七大秘诀
  3. 【luogu P4005 清华集训2017】小Y和地铁
  4. 由隐藏层节点数引起的网络准确率的不规则变化02
  5. 无法保存打印机设置 0x000006d9
  6. 关于用iframe大框架覆盖小框架的问题
  7. 算法:Reverse Words in a String(翻转字符串里的单词)
  8. 【微信小程序】从零开始搭建一个英语学习小程序01——基础准备
  9. java对zip、rar、7z文件带密码解压实例
  10. 删除google网页快照方法
  11. 有人问“一花一世界,一叶一菩提”
  12. 供应链金融融资的业务模式
  13. [视觉Slam十四讲(2)踩坑记录]第3讲:Fatal error :Eigen/core没有那个文件或目录
  14. ubuntu qq音乐/网易云音乐 播放没有声音,播放mv有声音,解决办法
  15. 太极自定义diy名片模板_没有合适的手帐本?拿走这些电子模板,自制属于自己的手帐本...
  16. Oracle用户管理和授权
  17. c 语言 如何设置串口波特率,STC89C52RC串口波特率程序
  18. ES搜索引擎增删改查操作
  19. 什么的发明使研制着能够成功研制微型计算机,1_1_科普知识竞赛试题(小学)
  20. Oracle OIM 原理

热门文章

  1. 6.5寸,双卡双待,廉价机,带不来惊喜的苹果,还能撑多久
  2. 在CSDN写文章是一种什么体验?
  3. xilinx 7系列FPGA ibert笔记
  4. 高内聚,低偶合指的是什么?
  5. 基于多目标优化方法的电梯零部件预防性维修期决策
  6. TypeError: e[h] is not a function
  7. java E201_01_05鬼谷算题
  8. android显示ios emoji表情符号,教程:在 Android 上也能用 iOS 新 Emoji 表情
  9. 年轻的战场--(抢了一个大沙发,老衲笑而不语,哈哈。。)
  10. 【博学谷学习记录】超强总结,用心分享 | java基础