CanvasContext.setShadow

Set the style including location of color for shadow.

Parameters

It is Object type.

PropertyTypeRangeDefault ValueDescription
offsetXNumber-0The offset of the shadow from the horizontal direction of the shape.
offsetYNumber-0The offset of the shadow from the vertical direction of the shape.
blurNumber0-1000The blur level of the shadow, the larger the value, the fuzzier.
colorColor-blackThe color of shadow.

Sample Code

copy
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.setFillStyle('red')
ctx.setShadow(15, 45, 45, 'yellow')
ctx.fillRect(20, 20, 100, 175)
ctx.draw()