We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Jittery text rotation
Page Index Toggle Pages: 1
Jittery text rotation (Read 424 times)
Jittery text rotation
Jan 13th, 2009, 6:16pm
 
Hi, I'm trying to make a circular text sketch but I've noticed that after rotation the letters are at slightly the wrong angle and position, making it look a bit messy. The sketch showing this is below. Hold down capital 'I' until the trail travels full circle then compare it to the inner ring, which is comprised of just rectangles that have undergone an identical rotation. The outer ring of 'I's jitters about a little.
Any help would be much appreciated!

//Source
char[] letters;
PFont font;
float ifontSize=80;

void setup()
{
 size(800, 800);
 noStroke();
 smooth();
 background(0);
 rectMode(CENTER);

 font = createFont("Arial", ifontSize);
 textFont(font);
 textAlign(CENTER,BASELINE);
 
 letters=new char[0];
}

void draw(){
 background(0);
 for(int i=0;i<letters.length;i++){
   pushMatrix();
   translate(width/2,height/2);
   rotate(-0.01*PI*(letters.length-i)+0.05);
   text(letters[i],0,height/2-50);
   rect(0,height/2-150,5,50);
   popMatrix();
 }
}
 
void keyPressed(){
 if(key>='A' && key<='z'){
   letters=append(letters,key);
 }
}
Re: Jittery text rotation
Reply #1 - Jan 13th, 2009, 6:26pm
 
Rotating characters is actually rotating bitmaps in Processing: it can't be as clean as drawing a vector shape at an exact location/rotation.
Re: Jittery text rotation
Reply #2 - Jan 13th, 2009, 7:36pm
 
Ah that makes sense. How can I get vector-based letters then?
Re: Jittery text rotation
Reply #3 - Jan 13th, 2009, 9:32pm
 
There are several ways...
Perhaps the simple is to use the Vertext library.
Or use Java/AWT rendering. I also did a sketch extracting vector information from TTF glyphs.
Or draw letters programmatically. Or load SVG text.
Re: Jittery text rotation
Reply #4 - Jan 13th, 2009, 11:55pm
 
I'll have a look into those. Cheers!
Page Index Toggle Pages: 1