How to draw transparent image with html5 canvas element

前端 未结 3 1264
别跟我提以往
别跟我提以往 2020-12-30 05:01

I am targeting google chrome. Is it possible to draw transparent images on a canvas? By transparent I mean the drawing the entire image at something like 50% opacity.

3条回答
  •  时光取名叫无心
    2020-12-30 05:40

    It's possible if you iterate thru the canvas' image-data and set the alpha value manually, then export the transparent image with the canvas.toDataURL method and insert it into another canvas.

提交回复
热议问题