Class Animation

  • All Implemented Interfaces:
    Runnable

    public class Animation
    extends Object
    implements Runnable
    The Animation class constructs objects that represent a single Animation. An Animation consists of a target and an array of segments. A target is the device or list of devices that are being animated. A segment is a short modular animation sequence (i.e. sit, stand, walk, etc). Segments are synchronous and run first-in, first-out.
    • Method Detail

      • getFps

        public int getFps()
      • getLoop

        public boolean getLoop()
      • setLoop

        public void setLoop​(boolean loop)
      • play

        public Future<?> play()
        Play the animation. Animation's are set to play by default and this only needs to be called if the animation has been paused or a segment's speed property was set to 0.
        Returns:
        Future instance for the background animation thread
      • stop

        public void stop()
        Immediately stop the animation and flush the segment queue.
      • getSpeed

        public float getSpeed()
        Get the current speed
        Returns:
        current speed factor
      • getPeriodMs

        public int getPeriodMs()
      • enqueue

        public void enqueue​(int durationMillis,
                            float[] cuePoints,
                            List<AnimationInstance.KeyFrame[]> keyFrames)
        Add a segment to the animation's queue.
        Parameters:
        durationMillis - Time in milliseconds for the entire animation
        cuePoints - List of relative time points at which to change to the next segment
        keyFrames - List of segment values for target
      • run

        public void run()
        Specified by:
        run in interface Runnable