WeChat applet development documentation
/ 微信小程序API 繪圖中使用setGlobalAlpha設(shè)置全局畫(huà)筆透明度
微信小程序API 繪圖中使用setGlobalAlpha設(shè)置全局畫(huà)筆透明度
setGlobalAlpha
定義
設(shè)置全局畫(huà)筆透明度。
參數(shù)
例子
const ctx = wx.createCanvasContext('myCanvas') ctx.setFillStyle('red') ctx.fillRect(10, 10, 150, 100) ctx.setGlobalAlpha(0.2) ctx.setFillStyle('blue') ctx.fillRect(50, 50, 150, 100) ctx.setFillStyle('yellow') ctx.fillRect(100, 100, 150, 100) ctx.draw()