javafx.animation

## Class AnimationTimer

- java.lang.Object
- - javafx.animation.AnimationTimer

-     public abstract class AnimationTimer
      extends Object

  The class `AnimationTimer` allows to create a timer, that is called in each frame while it is active. An extending class has to override the method `handle(long)` which will be called in every frame. The methods `start()` and `stop()` allow to start and stop the timer.
  Since:
    JavaFX 2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnimationTimer()` Creates a new timer.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `handle(long now)` This method needs to be overridden by extending classes.
    `void` | `start()` Starts the `AnimationTimers`.
    `void` | `stop()` Stops the `AnimationTimers`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AnimationTimer

          public AnimationTimer()

      Creates a new timer.

  - ### Method Detail

    - #### handle

          public abstract void handle(long now)

      This method needs to be overridden by extending classes. It is going to be called in every frame while the `AnimationTimer` is active.
      Parameters:
        `now` - The timestamp of the current frame given in nanoseconds. This value will be the same for all `AnimationTimers` called during one frame.

    - #### start

          public void start()

      Starts the `AnimationTimers`. Once it is started, the `handle(long)` method of this `AnimationTimers` will be called in every frame. The `AnimationTimers` can be stopped by calling `stop()`.

    - #### stop

          public void stop()

      Stops the `AnimationTimers`. It can be activated again by calling `start()`.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2019, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.