CanvasContext.scale

After the scale is invoked, the horizontal and vertical coordinate of the path created subsequently will be scaled. The scale will be multiplied if scale is invoked multiple times.

Parameters

It is Object type.

PropertyTypeDescription
scaleWidthNumber The scale size for horizontal coordinate(1 = 100%,0.5 = 50%,2 = 200%).
scaleHeightNumberThe scale size for vertical coordinate(1 = 100%,0.5 = 50%,2 = 200%).

Sample Code

copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas');

ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)

ctx.draw()

ctx.draw()