Search processing.org:

Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name | ### translate()
Examples |
    translate(30, 20);
    rect(0, 0, 55, 55);
    // Translating in 3D requires P3D
    // or OPENGL as a parameter to size()
    size(100, 100, P3D);
    translate(30, 20, -50);
    rect(0, 0, 55, 55);
    translate(30, 20);
    rect(0, 0, 55, 55);
    translate(14, 14);
    rect(0, 0, 55, 55);
Description | Specifies an amount to displace objects within the display window. The x parameter specifies left/right translation, the y parameter specifies up/down translation, and the z parameter specifies translations toward/away from the screen. Using this function with the z parameter requires using the P3D or OPENGL parameter in combination with size as shown in the above example. 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). If translate() is called within draw(), the transformation is reset when the loop begins again. This function can be further controlled by the pushMatrix() and popMatrix().
Syntax |
    translate(x, y);
    translate(x, y, z);
Parameters |
x | int or float: left/right translation
y | int or float: up/down translation
z | int or float: forward/back translation
Returns | None
Usage | Web & Application
Related | rotate() rotateX() rotateY() rotateZ() scale() pushMatrix() popMatrix()

Updated on November 22, 2008 08:39:25pm PST