当前位置:网站首页>Cesium polygon gradient texture (canvas)
Cesium polygon gradient texture (canvas)
2022-07-25 20:50:00 【The most ferocious little seal】
You can use it directly :Cesium.ImageMaterialProperty(options) Methods Material assignment .
// draw canvas The gradient ( It's used here Radial / round The gradient )
var canvas = document.getElementById("myCanvas");
if (canvas && canvas.getContext) {
let ctx = canvas.getContext("2d");
var grad = ctx.createRadialGradient(200, 200, 50, 260, 260, 200) // Create a gradient radial / Circular object
grad.addColorStop(0, "rgba(240,250,40,1)"); // Set gradient color
grad.addColorStop(0.25, "rgba(327,201,64,1)");
grad.addColorStop(0.5, "rgba(22,184,200,1)");
grad.addColorStop(1, "rgba(82,67,192,1)");
ctx.fillStyle = grad; // Set up fillStyle For the current gradient object
ctx.fillRect(0, 0, 500, 500); // Draw gradient graphics
}
// Draw polygon
viewer.entities.add({
polygon: {
// Get the specified properties (positions,holes( Areas in the drawing that need to be hollowed out ))
hierarchy: {
positions: Cesium.Cartesian3.fromDegreesArray([
120.9677706, 30.7985748,
110.20, 34.55,
120.20, 50.55
]),
},
extrudedHeight: 0.0,
// It can be used directly here canvas Elements
material: new Cesium.ImageMaterialProperty({
image: document.getElementById('myCanvas'),
transparent: true
}),
closeTop: false,
closeBottom: false
}
});
// After use, you can delete the previously drawn canvas
document.getElementById('myCanvas').remove();

canvas Fill gradient , Please see my other article : Click to see
边栏推荐
- 2022.7.24-----leetcode.1184
- Vulnhub | dc: 6 | [actual combat]
- If the order is not paid for 30 minutes, it will be automatically cancelled. How to achieve this? (Collection Edition)
- FanoutExchange交换机代码教程
- What's special about Huawei's innovative solutions to consolidate the foundation of ERP for small and medium-sized enterprises?
- Use Navicat to connect to MySQL database through SSH channel (pro test is feasible)
- Increase swap space
- Brush questions with binary tree (4)
- Automated testing ----- selenium (I)
- Remote - actual combat
猜你喜欢

leetcode-6129:全 0 子数组的数目

Unity VS—— VS中默认调试为启动而不是附加到Unity调试

leetcode-6125:相等行列对

FanoutExchange交换机代码教程

ROS_ Rqt toolbox
![[tensorrt] dynamic batch reasoning](/img/59/42ed0074de7162887bfe2c81891e20.png)
[tensorrt] dynamic batch reasoning

preprocessor directives

Leetcode-6127: number of high-quality pairs
![[advanced drawing of single cell] 07. Display of KEGG enrichment results](/img/60/09c5f44d64b96c6e4d57e5f426e4ed.png)
[advanced drawing of single cell] 07. Display of KEGG enrichment results

Focus on data | Haitai Fangyuan directly hits the construction idea of data security governance in the securities industry
随机推荐
Cloud native, Intel arch and cloud native secret computing three sig online sharing! See you today | issues 32-34
leetcode-6130:设计数字容器系统
MySQL inserts three tables with different values. The association condition is the primary foreign key. How about the syntax of the insertion statement?
牛客-TOP101-BM38
476-82(322、64、2、46、62、114)
preprocessor directives
从底层结构开始学习FPGA(16)----PLL/MMCM IP的定制与测试
Product principles of non-financial decentralized application
103. (cesium chapter) cesium honeycomb diagram (square)
Arrow parquet
Leetcode-79: word search
Solution to oom exceptions caused by improper use of multithreading in production environment (supreme Collection Edition)
Google guava is just a brother. What is the real king of caching? (glory Collection Edition)
Unity VS—— VS中默认调试为启动而不是附加到Unity调试
“链”接无限可能:数字资产链,精彩马上来!
Success factors of software R & D effectiveness measurement
MySQL date [plus sign / +] condition filtering problem
Leetcode-6127: number of high-quality pairs
Huatai Securities account opening process, is it safe to open an account on your mobile phone
Basic knowledge of Marine Geology