Class UnitMoveAnimation


  • final class UnitMoveAnimation
    extends Animation
    Class for the animation of units movement.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long ANIMATION_DELAY
      Display delay between one frame and another, in milliseconds.
      private static java.util.logging.Logger logger  
      private float scale
      The image scale.
      private int speed
      The animation speed client option.
    • Constructor Summary

      Constructors 
      Constructor Description
      UnitMoveAnimation​(Unit unit, Tile sourceTile, Tile destinationTile, int speed, float scale)
      Build a new movement animation.
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • ANIMATION_DELAY

        private static final long ANIMATION_DELAY
        Display delay between one frame and another, in milliseconds. 33ms == 30 fps
        See Also:
        Constant Field Values
      • speed

        private final int speed
        The animation speed client option.
      • scale

        private final float scale
        The image scale.
    • Constructor Detail

      • UnitMoveAnimation

        public UnitMoveAnimation​(Unit unit,
                                 Tile sourceTile,
                                 Tile destinationTile,
                                 int speed,
                                 float scale)
        Build a new movement animation.
        Parameters:
        unit - The Unit to be animated.
        sourceTile - The Tile the unit is moving from.
        destinationTile - The Tile the unit is moving to.
        speed - The animation speed.
        scale - The scale factor for the unit image.
    • Method Detail

      • executeWithLabel

        public void executeWithLabel​(javax.swing.JLabel unitLabel,
                                     Animations.Procedure paintCallback)
        The code to be executed when a unit is out for animation.
        Specified by:
        executeWithLabel in class Animation
        Parameters:
        unitLabel - A JLabel with an image of the unit to animate.
        paintCallback - A callback to request that the animation area be repainted.