CanvasContext.translate
Translate the original point of the coordinate. The default original point is the upper-left corner
Parameters
It is Object type.
Property | 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()