CanvasContext.setGlobalAlpha
Set the alpha of global brush.
Parameters
It is Object type.
Property | Type | Range | Description |
alpha | Number | 0-1 | The alpha value, 0 represents transparent and 1 represents non-transparent. |
Sample Code
copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.setFillStyle('yellow')
ctx.fillRect(10, 10, 150, 100)
ctx.setGlobalAlpha(0.2)
ctx.setFillStyle('blue')
ctx.fillRect(50, 50, 150, 100)
ctx.setFillStyle('red')
ctx.fillRect(100, 100, 150, 100)
ctx.draw()