Type + Code: Processing For Designers

Page 52

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

11.2

textAlign( ) Left, center, right As in previous examples, the for() function is in use again. In this case, the textAlign() function is working in conjunction with pushMatrix(), rotate(), text() and popMatrix(). This formula rotates an uppercase letter "S." The pushMatrix function “stacks” the rotation and text (to allow the mathematical operations involved in the transformation to be performed), and when it is finalized (the operations have been executed) popMatrix brings the result of the stacked functions (in this instance, a rotated “S”) back.

PFont myFont;

fill(0,0,0);

void setup() {

textAlign(LEFT);

size(800, 800);

pushMatrix(); rotate(PI*i/3);

background(255,255,255);

text("S",0,0); popMatrix();

// String[] fontList = PFont. list(); // println(fontList); myFont = createFont("TimesRoman",48); textFont(myFont,272); translate(400,400); for(int i=0;i<6;i=i+1) {

} }


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