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');
相關文章
相關標籤/搜索