Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies values to move the origin point in a canvas.
![]() ![]() |
Syntax
object.translate(x, y);
Parameters
x [in]
Type: numberThe value to add to horizontal (or x) coordinates.
y [in]
Type: numberThe value to add to vertical (or y) coordinates.
Return value
This method does not return a value.
Standards information
- HTML Canvas 2D Context, Section 3
Remarks
The ICanvasRenderingContext2D::translate method effectively remaps the (0,0) origin on a canvas. You can specify one or both parameters. When you call a canvas method such as ICanvasRenderingContext2D::lineTo, the translate value is added to the respective x-coordinate and y-coordinate values. ICanvasRenderingContext2D::translate does not return an error if either value or any derived value is out of the canvas dimensions.
.png)
.png)