title: How can I implement easing functions with a thread
body: <p>I'm trying to find an efficient, normal, or simple way to implementing easing-functions into my java program. I got the easing function to work but i feel like there is a more efficient way to do it; one that I can't see, possibly because of tunnel vision. here's the code I have; can someone show me what I should do differently or point me in the direction I need to go research</p>
  
  <pre><code>public class slide extends JPanel implements Runnable {
  
      Thread ease = new Thread(this);
      float total = 0;
      float dur;
  
      slide() {
  
          ease.start();
          setLayout(null);
  
      }
  
      public float calc(float t, float b, float c, float d) {
  
          return c * t / d + b;
  
      }
  
      public void run() {
          while (true) {
              try {
                  if (total &lt; 50) {
                      total += 1;
                  } else {
                      ease.stop();
                  }
                  setBounds(400, Math.round(200 * total / 50 + 0), 250, 150);
                  repaint();
                  System.out.println(total + " " + dur);
                  ease.sleep(10);
              } catch (Exception e) {
              }
          }
  
      }
  }
  </code></pre>
  
  <p>I tried to implement the calc() method for a linear easing function I found online but it's practically useless because I was forced I couldn't get it to work unless inserted the equation directly into the </p>