当前位置:网站首页>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)
边栏推荐
猜你喜欢

Import the data table in MySQL into Excel

面试官问:JS的继承

将某数据库N多表名作为另外一张表中某一列得值(范围可以是别的数据库中得某张表)

【嵌入式基础】内存(Cache,RAM,ROM,Flash)
![[elt.zip] openharmony paper Club - memory compression for data intensive applications](/img/54/8248c1d95b04498d44a00ea94a6c85.png)
[elt.zip] openharmony paper Club - memory compression for data intensive applications

The practice of dual process guard and keeping alive in IM instant messaging development

What is digitalization? What is digital transformation? Why do enterprises choose digital transformation?

Self supervised learning and drug discovery

基于可学习尺寸自适应分子亚结构的药物相互作用预测

How to optimize the "message" list of IM
随机推荐
Qu'est - ce que la numérisation? Qu'est - ce que la transformation numérique? Pourquoi les entreprises choisissent - elles la transformation numérique?
Lmsoc: a socially sensitive pre training method
面试官问:JS的继承
Original | 2025 to achieve the "five ones" goal! The four products of Jiefang power are officially released
如何高效读书学习
Data analysts too hot? Monthly income 3W? Tell you the true situation of this industry with data
LMSOC:一种对社会敏感的预训练方法
[embedded foundation] memory (cache, ram, ROM, flash)
利用redis bitmap实现人员在线情况监控
【牛客討論區】第四章:Redis
[Yocto RM] 4 - Source Directory Structure
数据库的新选择 Amazon Aurora
评价——秩和比综合评价
pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...
MapReduce elementary programming practice
Prometeus 2.35.0 新特性
Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection
Prometeus 2.35.0 new features
Adobe Premiere Basics - common video effects (cropping, black and white, clip speed, mirroring, lens halo) (XV)
评价——灰色关联分析