gpt4 book ai didi

Javascript - 通过用白色重新绘制来删除 Canvas 中的圆圈

转载 作者:行者123 更新时间:2023-11-30 06:11:11 26 4
gpt4 key购买 nike

<分区>

这只是一道理解题。

  1. 我填了一个黑色圆圈。
  2. 我在它上面填了一个白色圆圈。

  3. 我本以为什么都看不到,但我却看到了一个非常细的黑色圆圈。为什么 ?会发生什么 ?

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

ctx.fillStyle="black";
ctx.arc(50, 50, 20, 0, Math.PI * 2, true);
ctx.fill();

ctx.fillStyle="white";
ctx.arc(50, 50, 20, 0, Math.PI * 2, true);
ctx.fill();

https://jsfiddle.net/a4fuLbgk/1/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com