字母变大后如何变小? 用于处理
How can you reduce the size of the letters after you increase them?for processing
这个程序打印文本。此字体大小增加 5 至 250。当字体大小为 250 时,此字体大小减少 250 至 5。然后当字体大小为 5 时,此字体大小增加 5 至 250。
字体大小相差 5。
下面的代码是我做的。
但是,我无法将字母提高后缩小。
PFont myFont;
int ts= 5;
int ts2 = 250;
float x, y;
void setup() {
size(500, 500);
x = width/2;
y = height/2;
myFont = loadFont("휴먼가는샘체-48.vlw");
textFont(myFont);
fill(255);
}
void draw() {
background(180);
textSize(ts);
textAlign(CENTER);
text("이재용", x, y);
ts+=5;
delay(100);
}
为了控制字体大小 increase/decrease 你可以在应用程序的全局状态中添加一个步长变量,一旦大小达到边界就反转步长方向,例如:
PFont myFont;
int ts= 5;
int step = 5;
int ts2 = 250;
float x, y;
void setup() {
size(500, 500);
x = width/2;
y = height/2;
myFont = createFont("Georgia", 32);
textFont(myFont);
fill(255);
}
void draw() {
background(180);
textSize(ts);
textAlign(CENTER);
text("gf", x, y);
if(ts>=250){
step = -5;
}else if(ts<=5){
step = 5;
}
ts+=step;
delay(100);
}
这个程序打印文本。此字体大小增加 5 至 250。当字体大小为 250 时,此字体大小减少 250 至 5。然后当字体大小为 5 时,此字体大小增加 5 至 250。 字体大小相差 5。 下面的代码是我做的。 但是,我无法将字母提高后缩小。
PFont myFont;
int ts= 5;
int ts2 = 250;
float x, y;
void setup() {
size(500, 500);
x = width/2;
y = height/2;
myFont = loadFont("휴먼가는샘체-48.vlw");
textFont(myFont);
fill(255);
}
void draw() {
background(180);
textSize(ts);
textAlign(CENTER);
text("이재용", x, y);
ts+=5;
delay(100);
}
为了控制字体大小 increase/decrease 你可以在应用程序的全局状态中添加一个步长变量,一旦大小达到边界就反转步长方向,例如:
PFont myFont;
int ts= 5;
int step = 5;
int ts2 = 250;
float x, y;
void setup() {
size(500, 500);
x = width/2;
y = height/2;
myFont = createFont("Georgia", 32);
textFont(myFont);
fill(255);
}
void draw() {
background(180);
textSize(ts);
textAlign(CENTER);
text("gf", x, y);
if(ts>=250){
step = -5;
}else if(ts<=5){
step = 5;
}
ts+=step;
delay(100);
}