Type + Code: Processing For Designers

Page 32

Type + Code page >L< even {8} page Yeohyun Ahn. Viviana Cordova.

TYPE

5.0

translate( ) Position The translate( ) function controls the position of any image, object or, this time, letters shown in our window. The function translate( ) uses x, y axis coordinates to arrange position. (The horizontal axis coordinate is x and vertical axis coordinate is y.) In this case, the word “TYPE” is positioned towards the right side. For 3D work (for example, using 3D libraries such as OpenGL and JAVA3D), you can also add an axis coordinate of z, which is placed after y. This example, however, is based in 2D mode. PFont myFont; void setup() { size(200, 200); background(255,255,255); myFont = createFont("Univers", 32); textFont(myFont); //position x:142 and y:90 translate(142,90); text("TYPE"); }

In both examples, the position for the y coordinate remains the same, while decreasing the x coordinate from 142 to 125, shifts its position from right to left. Thus, you can determine the exact horizontal and vertical placement by changing the value for x and y .

TYPE

Top: translate(142,90); Bottom: translate(125,90);

http://processing.org/reference/translate_.html


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.