canvas设置阴影

  1. 属性

    shadowOffsetX = float           阴影向右偏移量
    shadowOffsetY = float           阴影向下偏移量
    shadowBlur = float              阴影模糊效果
    shadowColor = color             阴影颜色
    
  2. 设置阴影

    canvas设置阴影

    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');
    
    ctx.shadowOffsetX = 10;
    ctx.shadowOffsetY = 10;
    ctx.shadowBlur = 10;
    ctx.shadowColor = 'rgba(0, 0, 0, 0.5)';
    
    ctx.fillRect(25, 25, 100, 100);
    

相关文章:

  • 2021-10-22
  • 2021-08-16
  • 2021-09-05
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2021-12-09
  • 2021-07-28
  • 2022-12-23
  • 2021-12-30
  • 2021-09-26
  • 2022-12-23
相关资源
相似解决方案