如何使用html5 canvas元素绘制透明图像

如何使用html5 canvas元素绘制透明图像

问题描述:

我定位的是Google Chrome。是否可以在画布上绘制透明图像?透明我的意思是在像50%不透明度的东西绘制整个图像。

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.

画布元素有一个全局alpha属性,可让您对绘制的任何部分应用部分透明。请参阅: whatwg

The canvas element has a global alpha attribute that lets you apply partial transparency to anything you draw. See: whatwg.