Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining

translate method

Specifies values to move the origin point in a canvas.

HTML Canvas 2D Context, Section 3Internet Explorer 9



object.translate(x, y);


x [in]

Type: number

The value to add to horizontal (or x) coordinates.

y [in]

Type: number

The value to add to vertical (or y) coordinates.

Return value

This method does not return a value.

Standards information


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.



Community Additions

© 2015 Microsoft