Problem with displaying rotated text
in
Programming Questions
•
3 months ago
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;
- }
1