
CODE 3

CODE 3
PFont myFont;
void setup(){
size(900,900);
background(255,255,255);
myFont=createFont("SentyWen",125);
textFont(myFont,125);
translate(300,300);
for(int i=0;i<10;i=i+1){
fill(0,0,0);
//textAlign(CENTER);
pushMatrix();
rotate(PI*i/5);
text("yann",0,0);
popMatrix();
}
}
Original Code
PFont myfont;
void setup(){
size(800,800);
background(255,255,255);
myfont=createFont("SentyWen",272);
textFont(myfont,272);
translate(400,400);
for(int i=0;i<6;i=i+1){
fill(0,0,0);
textAlign(CENTER);
pushMatrix();
rotate(PI*i/3);
text("The",0,0);
popMatrix();
}
}

Original Code

Modifications
1) Change the size of the screen:
size(800,800);
to
size(900,900);
2) Change the font size:
myfont=createFont("SentyWen",272);
textFont(myfont,272);
to
myfont=createFont("SentyWen",125);
textFont(myfont,125);
3) Rotate text around a circle:
rotate(PI*i/3);
to
rotate(PI*i/5);
4) Change the text:
text("The",0,0);
to
text("yann",0,0);
5) Inactivate Text Align:
textAlign(CENTER)
to
//textAlign(CENTER);
6) Translation of the letter:
translate(400,400);
for(int i=0;i<6;i=i+1)
to
translate(300,300);
for(int i=0;i<10;i=i+1)
Function Analyse
This code makes a phrase rotate and creates patterns. Although it is similar to the first code, it is still a different function. This code used the translate function to let the phrase move and so creates a pattern. The translate function is used to specifies an amount to displace objects within the display window. The translation of the phrase "Yann" creates a pattern:
translate(300,300);
for(int i=0;i<10;i=i+1)
Then function textAlign () can also cause many differences upon the pattern. The difference can be seen in the first picture above which the textAlign() function has been deactivated and the picture below which the textAlign() function was working.
Finally, the code that makes the text rotate around one circle is :
pushMatrix();
rotate(PI*i/5);
text("yann",0,0);
popMatrix();
By using this code, the text will rotate around a circle. In this code, the amount that the text rotate around will be specified by PI. In addition, the function pushMatrix() and popMatrix() is also important. The pushMatrix() function saves the current coordinate system which is rotate(PI*i/5) in this code to the stack and popMatrix() restores the prior coordinate system which is translate(300,300); in this code. pushMatrix() and popMatrix() are used in conjunction with the other transformation functions and may be embedded to control the scope of the transformations.