小编use*_*655的帖子

改善旋转文本的显示

我有以下代码改编自旋转文本的在线示例.代码工作正常,因为它将文本旋转到正确的角度,但我想知道是否有办法提高旋转文本的准确性和清晰度.在我的显示器上看起来好像旋转的文本是"步进"而不是平滑.

PFont f;
String message = "abcdefghijklmnopqrstuvwxyz";
float theta, x;

void setup() {
  size(800, 200);
  f = createFont("Arial",20,true);
}

void draw() { 
 // background(255);
  fill(0);
  textFont(f);    // Set the font
  translate(x,height/2);  // Translate to the center
  rotate(theta);                // Rotate by theta
  textAlign(LEFT);            
  text(message,0,0);            
  theta += 0.1;                // Increase rotation
  x += textWidth(message);
  if (x>800){noLoop(); }
}
Run Code Online (Sandbox Code Playgroud)

我通过示例进行了修改,以帮助显示差异.在新代码中,我将文本更改为一串下划线,并以红色绘制参考线.如果它在您的机器上运行相同,您应该会看到由下划线创建的黑线中的交错.

String message = "________";
float theta, x;
PFont f;

void setup() {
  size(800, 200);
  f = loadFont("ArialMT-20.vlw");
  smooth();
}

void draw() { 
  fill(0); …
Run Code Online (Sandbox Code Playgroud)

java processing text rotation

5
推荐指数
1
解决办法
319
查看次数

标签 统计

java ×1

processing ×1

rotation ×1

text ×1