Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API drawing setShadow (set shadow style)


May 19, 2021 WeChat Mini Program Development Document


Table of contents


WeChat small program API drawing setShadow (set shadow style) Drawing interfaces and methods


canvasContext.setShadow


Defined

Set the shadow style.

Tip: If not set, offsetX default is 0, offsetY default is 0, blur default is 0, color default is black

Parameters

Parameters Type Range Defined
offsetX Number The offset of the shadow relative to the shape horizontally
offsetY Number The offset of the shadow relative to the shape in the vertical direction
blur Number 0~100 The fuzzy level of the shadow, the larger the value, the more blurry it becomes
color Color The color of the shadow

Example

const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.setShadow(10, 50, 50, 'blue')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()

WeChat small program API drawing setShadow (set shadow style)

WeChat small program API drawing setShadow (set shadow style) Drawing interfaces and methods