Loading...
Logo
Processing Forum
mircoc's Profile
1 Posts
1 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    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.
    1. PVector position;
    2. PVector velocity;

    3. void setup() {
    4. size(700, 700);
    5.  background(255);
    6.  smooth();
    7.  position = new PVector(0,0);
    8.  velocity = new PVector(1, 0);

    9. void draw(){
    10.  background(255);
    11.  rotate(radians(45));
    12.  fill(255);
    13.  rect(position.x, position.y, 350, 75);
    14.  fill(0);
    15.  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);
    16.  if(out()){
    17.    position.x=0;
    18.    background(255, 255, 255);
    19.  }else{
    20.    update();
    21.  }
    22. }

    23. void update(){
    24.  position.add(velocity);
    25. }

    26. boolean out(){
    27.  if(position.x>(sqrt(pow(width,2)+pow(height,2)))/2+350){
    28.    return true;
    29.  }
    30.  return false;
    31. }