Is it possible to make a gradient-transparent/layer masking image using canvas?

后端 未结 5 1972
傲寒
傲寒 2021-02-05 14:01

I\'ve been following the lessons about transparency and gradients on the Mozilla site: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Canvas_tutorial/Applying_styles_an

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 14:16

    If you need to make an image transparent set the ctx.globalAlpha to whatever you need (1, no transparency, is default). Then reset it after you draw your image. This URL probably will help as well https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Canvas_tutorial/Compositing.

提交回复
热议问题