CanvasContext.translate
Transfor the original point of the coordinate. The default orginal point is the upper-left corner
Parameters
It is Object type.
Field | Type | Description |
x | Number | The offset of x coordinate |
y | Number | The 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()