Class AnimationTimer
public abstract class AnimationTimer extends Object
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.
The animation timer runs on the JavaFX Application Thread.
- Since:
- JavaFX 2.0
Constructor Summary
| Constructor | Description |
|---|---|
AnimationTimer() |
Creates a new timer. |
Method Summary
Constructor Details
AnimationTimer
public AnimationTimer()
Method Details
handle
public abstract void handle(long now)
AnimationTimer is active.- Parameters:
-
now- The timestamp of the current frame given in nanoseconds. This value will be the same for allAnimationTimerscalled during one frame.
start
public void start()
AnimationTimer. Once it is started, the handle(long) method of this AnimationTimer will be called in every frame. The AnimationTimer can be stopped by calling stop().
Note: if this method is not called on the JavaFX Application Thread, it is delegated to it automatically. In this case, the call is asynchronous and may not happen immediately.
stop
public void stop()
AnimationTimer. It can be activated again by calling start(). Note: if this method is not called on the JavaFX Application Thread, it is delegated to it automatically. In this case, the call is asynchronous and may not happen immediately.
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.