<script>
CSS.paintWorklet.addModule('https://codepen.io/hiro0218/pen/Yzxmwop.js');
</script>
body {
width: 100vw;
height: 100vh;
background-image: paint(KamadoTanjiro);
}
View Compiled
class Painter {
paint(context, size) {
const color1 = "#58ba97";
const color2 = "#2c2421";
const units = 200;
for (let x = 0; x < size.width; x += units) {
for (let y = 0; y < size.height; y += units) {
context.fillStyle = (x + y) % (units * 2) === 0 ? color1 : color2;
context.fillRect(x, y, units, units);
}
}
}
}
if (typeof registerPaint !== "undefined") {
registerPaint("KamadoTanjiro", Painter);
}
View Compiled
This Pen doesn't use any external JavaScript resources.