当前位置:网站首页>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
边栏推荐
- Kubernetes进阶部分学习笔记
- If the order is not paid for 30 minutes, it will be automatically cancelled. How to achieve this? (Collection Edition)
- 每条你收藏的资讯背后,都离不开TA
- Volcanic engine Xiang Liang: machine learning and intelligent recommendation platform multi cloud deployment solution officially released
- matlab----EEGLab查看脑电信号
- Recommend a website that converts curl commands into PHP code & a website that initiates and executes curl requests online
- Wokerman custom write log file
- Behind every piece of information you collect, you can't live without TA
- Network protocol: TCP part2
- Scan delete folder problems
猜你喜欢

Online random coin tossing positive and negative statistical tool

Kubernetes进阶部分学习笔记

Too many passwords, don't know how to record? Why don't you write a password box applet yourself

How to choose a microservice registration center?

Chinese son-in-law OTA Ono became the first Asian president of the University of Michigan, with an annual salary of more than 6.5 million!

How to use buffer queue to realize high concurrent order business (glory Collection Edition)

Docker builds redis cluster

毕业从事弱电3个月,我为什么会选择转行网络工程师

Learn FPGA from the bottom structure (16) -- customization and testing of pll/mmcm IP

Recommended books | essentials of industrial digital transformation: methods and Practice
随机推荐
Interpretation of filter execution sequence source code in sprigboot
程序的编译和运行
leetcode-6126:设计食物评分系统
Docker builds redis cluster
[FAQ] access the HMS core push service, and the server sends messages. Cause analysis and solutions of common error codes
Struct, enum type and union
If the order is not paid for 30 minutes, it will be automatically cancelled. How to achieve this? (Collection Edition)
leetcode-919:完全二叉树插入器
[tensorrt] dynamic batch reasoning
LeetCode刷题——猜数字大小II#375#Medium
Question and answer 47: geeks have an appointment - the current monitoring system construction of CSC
Introduction to MySQL engine and InnoDB logical storage structure
Pycharm跑程序时自动进入测试模式
Remote - actual combat
Open source SPL enhances mangodb computing
Has baozi ever played in the multi merchant system?
Beisen Holdings' IPO: a total loss of 4.115 billion yuan in three years, and a total of 2.84 billion yuan in the previous nine rounds of financing
Yolov7 training error indexerror: list index out of range
Temperature and humidity environment monitoring system based on stm32
Huatai Securities account opening process, is it safe to open an account on your mobile phone