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 & HelpPrograms › Scrolling Text
Page Index Toggle Pages: 1
Scrolling Text (Read 1389 times)
Scrolling Text
Dec 19th, 2005, 6:22pm
 
Hey,

I'm a little stumped with scrolling text across the screen. I was wondering if anyone has code for this. I can get the text loaded, but it won't move.

Cheers,

Walbert

P.s Processing rocks?!
Re: Scrolling Text
Reply #1 - Dec 20th, 2005, 4:09pm
 
i'd guess this would scroll your text from right to left..
hope this gives you a head-start for whatever you're trying to do..

Code:


int x, y;
PFont dFont;
void setup()
{
size(300,300);
x = width;
y = 10+(int)random(height-20); // not entire height so the text is allways inside the screen.

dFont = loadFont("FONTNAME-10.vlw");
textFont(dFont,10);
textAlign(LEFT);
}

void draw()
{
background(255);
fill(0);
text("scrolling",x,y);
x -= speed;
if(x<-50){ // use x<-textWidth("scrolling") or something here to get the proper clipping of the text
x = width;
y = 10+(int)random(height-20);
}
}



-seltar
Re: Scrolling Text
Reply #2 - Dec 22nd, 2005, 5:30pm
 
Thanks man, thats a great help.
Page Index Toggle Pages: 1