Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
mircoc
mircoc's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Problem with displaying rotated text
[2 Replies]
01-Jul-2013 11:51 AM
Forum:
Programming Questions
I have created a program (shown below) which displays rotated text in motion. The text is rotated by 45 degrees
and moves from the top left to the bottom right of the screen.
The problem is that the text, while moving, "vibrates", and this happens with the latest version
of Processing both under OS X and Windows.
Is this an unavoidable rendering problem, or is there a way to make the text move smoothly?
Thanks for any help.
PVector position;
PVector velocity;
void setup() {
size(700, 700);
background(255);
smooth();
position = new PVector(0,0);
velocity = new PVector(1, 0);
}
void draw(){
background(255);
rotate(radians(45));
fill(255);
rect(position.x, position.y, 350, 75);
fill(0);
text ("text vibrating: Lorem Ipsum is simply dummy text of the printing and typesetting industry.", position.x+5, position.y+5, 350-100, 75-10);
if(out()){
position.x=0;
background(255, 255, 255);
}else{
update();
}
}
void update(){
position.add(velocity);
}
boolean out(){
if(position.x>(sqrt(pow(width,2)+pow(height,2)))/2+350){
return true;
}
return false;
}
«Prev
Next »
Moderate user : mircoc
Forum