21 lines
643 B
HTML
21 lines
643 B
HTML
<!DOCTYPE html><!-- webkit-test-runner [ CSSPaintingAPIEnabled=true ] -->
|
|
|
|
<canvas id="paint" style="width: 150px; height: 150px;" ></canvas>
|
|
|
|
<script id="code">
|
|
const canvas = document.getElementById('paint');
|
|
canvas.width = 150 * window.devicePixelRatio;
|
|
canvas.height = 150 * window.devicePixelRatio;
|
|
|
|
const ctx = canvas.getContext('2d');
|
|
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
|
|
|
for (var i = 0; i < 6; i++){
|
|
for (var j = 0; j < 6; j++){
|
|
ctx.fillStyle = 'rgb(' + Math.floor(255 - 42.5 * i) + ',' +
|
|
Math.floor(255 - 42.5 * j) + ',0)';
|
|
ctx.fillRect(j * 25, i * 25, 25, 25);
|
|
}
|
|
}
|
|
</script>
|