# Class AnimationTime

java.lang.Object
com.codename1.ui.animations.AnimationTime

public final class AnimationTime extends Object

Pluggable time source for animations across the framework. Defaults to `System.currentTimeMillis()` but can be overridden with an explicit value to support deterministic playback (e.g. UI tests), to advance animations at a custom pace (slow-motion, fast-forward), or to step through animation frames manually.

All methods are static and the class holds only primitive state to keep the hot path cheap - `now()` is invoked from every animation tick.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `isOverridden()`
  Returns true when an override time is currently active.
  `static long`
  `now()`
  Returns the current animation time in milliseconds.
  `static void`
  `reset()`
  Clears any override and restores now() to delegate to `System.currentTimeMillis()`.
  `static void`
  `setTime(long time)`
  Overrides the value returned by now().

  ### Methods inherited from class Object

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

- ## Method Details

  - ### now

    public static long now()

    Returns the current animation time in milliseconds. Returns `System.currentTimeMillis()` unless an override has been set via setTime(long).

    ###### Returns

    the current animation time in milliseconds

  - ### setTime

    public static void setTime(long time)

    Overrides the value returned by now(). Once set, every animation reading the clock will see the same `time` value until either this method is called again or reset() is invoked. Advancing animations while overridden requires repeatedly calling this method with increasing values.

    ###### Parameters

    - `time`: the time in milliseconds that now() should return

  - ### reset

    public static void reset()
    Clears any override and restores now() to delegate to `System.currentTimeMillis()`.

  - ### isOverridden

    public static boolean isOverridden()

    Returns true when an override time is currently active.

    ###### Returns

    true when now() is returning an overridden value