It is possible to change the string input after i run the code?
in
Programming Questions
•
1 year ago
Hi there,
I tried to create some unique shape with alphabets with the following codes. But i have to keep change the string variable manually. Is there a way to change the string input after i run the code? Means after i run the code, it will output the default unique shape, but when i key in any letter or symbol, it will over-write the previous string and display the new unique shape with the new string input. I tried to name the string and using keypress function, but it does not allow me to do so. Please advise me. Thanks.The following is the code:
//declare variable myFont
PFont myFont;
void setup(){
size(800,800);
background(255,255,255);
//String[] fontList = PFont.list();
//println(fontList);
myFont = createFont("GenBasB.ttf",48);
textFont(myFont,272);
fill(0,0,0);
translate(400,400);
for (int i=0; i<12; i=i+1) {
fill(0,0,0);
textAlign(CENTER); //LEFTCENTERRIGHT
pushMatrix();
rotate(PI*i/1.5);
text("type",0,0);
popMatrix();
}
}
I tried to create some unique shape with alphabets with the following codes. But i have to keep change the string variable manually. Is there a way to change the string input after i run the code? Means after i run the code, it will output the default unique shape, but when i key in any letter or symbol, it will over-write the previous string and display the new unique shape with the new string input. I tried to name the string and using keypress function, but it does not allow me to do so. Please advise me. Thanks.The following is the code:
//declare variable myFont
PFont myFont;
void setup(){
size(800,800);
background(255,255,255);
//String[] fontList = PFont.list();
//println(fontList);
myFont = createFont("GenBasB.ttf",48);
textFont(myFont,272);
fill(0,0,0);
translate(400,400);
for (int i=0; i<12; i=i+1) {
fill(0,0,0);
textAlign(CENTER); //LEFTCENTERRIGHT
pushMatrix();
rotate(PI*i/1.5);
text("type",0,0);
popMatrix();
}
}
1