// 渐变色
// 基础线样式参考默认样式即可
function lineStyle() {
//渐变色线
let styleLine = [];
let steps = 10;
// 渐变色原理,其实就是多个样式共同使用
for (let i = 0; i < steps; i++) {
styleLine.push(
new ol.style.Style({
stroke: new ol.style.Stroke({
color: [0, 255, 255, 1 / (steps - i)],
// color: [0, 255, 255, 1 / (steps - i)],
width: (steps - i) * 2 - 1
}),
})
);
}
let lineFeature = features[1];
lineFeature.setStyle(styleLine);
}
————————————————
版权声明:本文为CSDN博主「Southejor」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/linzi19900517/article/details/123571088
openlayer 渐变线
最新推荐文章于 2024-05-23 15:34:19 发布