当前位置:网站首页>Cesium Color 颜色(赋值)随机颜色
Cesium Color 颜色(赋值)随机颜色
2022-06-28 00:05:00 【最凶残的小海豹】
赋值方式:
1. 英文颜色单词
// 设置颜色: Cesium.Color.颜色
Cesium.Color.WHITE;
// 设置颜色和透明度: esium.Color.颜色.透明度
Cesium.Color.BLUE.withAlpha(0.4)
// 透明色
Cesium.Color.TRANSPARENT;
2. rgba(0-255区间)注意:这里 alpha 也是0-255区间
// Cesium.Color.fromBytes(red ,green ,blue ,alpha ,result)
// result是颜色设定结果,可存储到的对象也可不用。
Cesium.Color.fromBytes(177, 0, 4, 200);
3. rgba(0-1区间) 计算方式:255区间的值 / 255
// Cesium.Color(red, green, blue, alpha)
Cesium.Color(177/255, 0/255, 4/255, 1)
Cesium.Color(0.165, 0.165, 0.165, 1)
4. CSS 色值转换
// Cesium.Color.fromCssColorString('CSS色值')
Cesium.Color.fromCssColorString("#ffffff")
Cesium.Color.fromCssColorString("rgba(255, 255, 255, 0.75)")
6. 32位GRBA值
// Cesium.Color.fromRgba(rgba, result)
Cesium.Color.fromRgba(0x67ADDFFF)
7. 随机颜色
// Cesium.Color.fromRandom({alpha: 透明度})
Cesium.Color.fromRandom({
alpha: 0.5})
小技巧:
只修改透明度不修改原本的颜色,可以使用 getValue 方法
// 设置字体填充透明度
label.fillColor = label.fillColor.getValue().withAlpha(0.8);
// 设置字体外边框透明度
label.outlineColor= label.outlineColor.getValue().withAlpha(0.8);
// 设置球地下颜色的透明度 (这里用 undergroundColor 返回的也是 Cesium.Color 对象)
globe.viewer.scene.globe.undergroundColor.withAlpha(0.8)
边栏推荐
- 【牛客討論區】第四章:Redis
- Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
- How to understand query, key and value in transformer
- 将某数据库N多表名作为另外一张表中某一列得值(范围可以是别的数据库中得某张表)
- MapReduce elementary programming practice
- Interview guide for data person | prepare these points to be prepared!
- Hi, you have a code review strategy to check!
- 嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)
- [Yocto RM] 2 - Yocto Project Terms
- MySQL十种锁,一篇文章带你全解析
猜你喜欢
![[embedded foundation] serial port communication](/img/b7/18fec20e2d5fa5f226c6f8bb1e93d2.png)
[embedded foundation] serial port communication

TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language

Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)

树莓派实现温控风扇智能降温

MapReduce elementary programming practice

766. toplitz matrix

How to optimize the "message" list of IM

Machine learning notes - time series as features

嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)

【嵌入式基础】串口通信
随机推荐
COSCon'22 讲师征集令
I/o limit process and CPU limit process
利用redis bitmap实现人员在线情况监控
力扣今日题-522. 最长特殊序列
[Yocto RM]9 - QA Error and Warning Messages
如何理解 Transformer 中的 Query、Key 与 Value
Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
【牛客討論區】第四章:Redis
[Yocto RM] 2 - Yocto Project Terms
Hi, you have a code review strategy to check!
树莓派实现温控风扇智能降温
【嵌入式基础】内存(Cache,RAM,ROM,Flash)
Set collection usage
205. 同构字符串
数据库的新选择 Amazon Aurora
Prometeus 2.35.0 new features
I/O限制进程与CPU限制进程
[elt.zip] openharmony paper Club - memory compression for data intensive applications
Evaluation - grey correlation analysis
[Yocto RM]1 - System Requirements