translate(tx, ty)

Specifies an amount to displace objects within the page. The x parameter specifies left/right translation, the y parameter specifies up/down translation. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling translate(50, 0) and then translate(20, 0) is the same as translate(70, 0). This function can be further controlled by the pushMatrix() and popMatrix().

Type: function

Parameter(s):

  • tx {Number}:

    The amount of offset on the X axis.

  • ty {Number}:

    The amount of offset on the Y axis.