标签:tor let reg parent efi its round register 透明
.box {
width: 180px; height: 180px;
background: paint(transparent-grid);
}
<div class="box"></div>
if (window.CSS) {
CSS.paintWorklet.addModule(‘paint-grid.js‘);
}
registerPaint(‘transparent-grid‘, class {
paint(context, size) {
// 两个格子颜色
var color1 = ‘#fff‘;
var color2 = ‘#eee‘;
// 格子尺寸
var units = 8;
// 横轴数轴循环遍历下
for (var x = 0; x < size.width; x += units) {
for (var y = 0; y < size.height; y += units) {
context.fillStyle = (x + y) % (units * 2) === 0 ? color1 : color2;
context.fillRect(x, y, units, units);
}
}
}
});
标签:tor let reg parent efi its round register 透明
原文地址:https://www.cnblogs.com/xieyongbin/p/10159931.html