Package snap.view

Class ViewTimer

java.lang.Object
snap.view.ViewTimer

public class ViewTimer extends Object
A Timer to fire on node event thread.
  • Constructor Details

    • ViewTimer

      public ViewTimer()
      Creates a new ViewTimer.
    • ViewTimer

      public ViewTimer(int aPeriod, Consumer<ViewTimer> onFire)
      Creates a new ViewTimer for period and action.
  • Method Details

    • getPeriod

      public int getPeriod()
      Returns the time in milliseconds between firings.
    • setPeriod

      public void setPeriod(int aPeriod)
      Sets the time in milliseconds between firings.
    • getOnFire

      public Consumer<ViewTimer> getOnFire()
      Returns the on frame.
    • setOnFire

      public void setOnFire(Consumer<ViewTimer> onFire)
      Sets the on frame.
    • isRunning

      public boolean isRunning()
      Returns whether timer is running.
    • isPaused

      public boolean isPaused()
      Returns whether timer is running.
    • getTime

      public int getTime()
      Returns the elapsed time.
    • getCount

      public int getCount()
      Returns the number of times the timer has fired.
    • start

      public void start()
      Start timer.
    • start

      public void start(int aDelay)
      Start timer.
    • stop

      public void stop()
      Stop timer.
    • pause

      public void pause()
      Pauses the timer (next play will start from previous time).
    • sendEvent

      protected void sendEvent()
      Sends the event.