Class Animator

java.lang.Object
java.lang.Thread
common.animation.Animator
All Implemented Interfaces:
Runnable

public class Animator extends Thread
Created by IntelliJ IDEA. User: orsotronIII This class is a simple thread which only purpose is to update an Animation implementing class, which must be passed as a construction parameter. Modified by Bertoli Marco to terminate correctly.
  • Field Details

    • animation

      protected Animation animation
      The Animation implementing class that has to be updated to show the animation.
  • Constructor Details

    • Animator

      public Animator(Animation a)
      Creates a new instance of Animator. Frame rate is set by default at 30 frames per seconds.
      Parameters:
      a - : Animation to be updated by this animator.
    • Animator

      public Animator(double fps, Animation a)
      Creates a new instance of Animator with explicit definition of framerate.
      Parameters:
      fps - : framerate for this animation.
      a - : Animation to be updated by this animator.
  • Method Details

    • start

      public void start()
      Starts the handled animation
      Overrides:
      start in class Thread
    • run

      public void run()
      Performs update of the handled animation as far as terminate() method has not been called.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • terminate

      public void terminate()
      Terminates current animation