canvas填充规则

canvas填充规则

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

ctx.beginPath(); 
ctx.fillStyle='green'
ctx.arc(50, 50, 30, 0, Math.PI * 2, true);
ctx.arc(50, 50, 20, 0, Math.PI * 2, true);
ctx.arc(50, 50, 15, 0, Math.PI * 2, true);
ctx.arc(50, 50, 10, 0, Math.PI * 2, true);
ctx.fill('evenodd');
原文地址:https://www.cnblogs.com/ye-hcj/p/10357486.html