/* Auteur: Nicolas JANEY, nico@univ-fcomte.fr */

public class ThreadTransformations extends Thread {

  private Transformations t ;
  private boolean bRun ;
  private double dx = 0.01 ;
  private double dy = -0.013 ;

  public ThreadTransformations(Transformations trans) {
    super();
    t = trans;
    bRun = false;
  }

  public void run() {
    bRun = true;
    while (bRun) {
      try {
        sleep(15); }
      catch(InterruptedException ie) {} ;
    t.a += 0.01;
    if ( ( t.sx <= 0.3 ) | ( t.sx >= 1.2 ) )
      dx = -dx ;
    t.sx += dx;
    if ( ( t.sy <= 0.3 ) | ( t.sy >= 1.2 ) )
      dy = -dy ;
    t.sy += dy;
    t.repaint(); }
  }
}