CanvasContext.translate

Transfor the original point of the coordinate. The default orginal point is the upper-left corner

Parameters

It is Object type.

FieldTypeDescription
xNumberThe offset of x coordinate
yNumberThe offset of y coordinate

Sample Code

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

ctx.strokeRect(20, 20, 250, 80)
ctx.translate(30, 30)
ctx.strokeRect(20, 20, 250, 80)
ctx.translate(30, 30)
ctx.strokeRect(20, 20, 250, 80)

ctx.draw()