Interface Animatable

    • Method Detail

      • moveTo

        default AnimationBuilder moveTo​(int x,
                                        int y,
                                        double duration)
        Move this to the specified x and y over duration seconds
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly move to (100, 100) over 3 seconds
         c.moveTo(100, 100, 3);
         
        Parameters:
        x - the x position to move to
        y - the y position to move to
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • colorTo

        default AnimationBuilder colorTo​(int r,
                                         int g,
                                         int b,
                                         double duration)
        Change the color of this to the specified color over duration seconds. See Wikipedia for how this works.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly turn red over 3 seconds
         c.colorTo(255, 0, 0, 3);
         
        Parameters:
        r - red (0-255)
        g - green (0-255)
        b - blue (0-255)
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • colorTo

        default AnimationBuilder colorTo​(int r,
                                         int g,
                                         int b,
                                         int a,
                                         double duration)
        Change the color of this to the specified color over duration seconds. See Wikipedia for how this works.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly turn red with with 100/255 opacity over three seconds
         c.colorTo(255, 0, 0, 100, 3);
         
        Parameters:
        r - red (0-255)
        g - green (0-255)
        b - blue (0-255)
        a - alpha (0-255)
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • colorTo

        default AnimationBuilder colorTo​(int hex,
                                         double duration)
        Change the color of this to the specified color over duration seconds. See Wikipedia for how this works.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly turn red over three seconds
         c.colorTo(0xFF0000, 3);
         
        Parameters:
        hex - the number describing the RGB color
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • colorTo

        default AnimationBuilder colorTo​(Hue hue,
                                         double duration)
        Change the color of this to the specified color over duration seconds.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly turn red over 3 seconds
         c.colorTo(0xFF0000, 3);
         
        Parameters:
        hue - the hue
        duration - the number of seconds it lasts
        Returns:
        a ColorAnimation
      • colorTo

        default AnimationBuilder colorTo​(java.lang.String name,
                                         double duration)
        Change the color of this to the specified color over duration seconds.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly turn red over 3 seconds
         // then, the circle will slowly turn blue over 3 seconds
         c.colorTo("red", 3).colorTo("#0000FF", 3);
         
        Parameters:
        name - the hue name or the hex code
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • colorTo

        default AnimationBuilder colorTo​(java.awt.Color color,
                                         double duration)
        Change the color of this to the specified color over duration seconds. See Color for the full list of colors, and constructors for this class
        
         Circle c = new Circle(200, 200, 50);
         // the circle will turn slowly red over 3 seconds
         c.colorTo(Color.RED, 3);
         
        Parameters:
        color - the color to fade to
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • fadeOut

        default AnimationBuilder fadeOut​(double duration)
        Fade this out over duration seconds.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly fade out over 3 seconds
         c.fadeOut(3);
         
        Parameters:
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • fadeIn

        default AnimationBuilder fadeIn​(double duration)
        Fade this in over duration seconds.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly fade out over 3 seconds
         // then, fade back in over 3 seconds
         c.fadeOut(3).fadeIn(3);
         
        Parameters:
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • rotateTo

        default AnimationBuilder rotateTo​(int angle,
                                          double duration)
        Rotate this to the specified angle degrees over duration seconds. If you supply an angle > 360 it will make more than one full rotation.
        
         Square s = new Square(200, 200, 50);
         // the square will slowly rotate one turn counter-clockwise over 3 seconds
         // then, slowly rotate two turns clockwise over 3 seconds
         c.rotateTo(360, 3).rotateTo(-360, 3);
         
        Parameters:
        angle - the absolute angle to rotate to in degrees.
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • rotateBy

        default AnimationBuilder rotateBy​(int angle,
                                          double duration)
        Rotate this by angle degrees over duration seconds. If you supply an angle > 360 it will make more than one full rotation.
        
         Square s = new Square(200, 200, 50);
         // the square will slowly rotate one turn counter-clockwise over 3 seconds
         // then, slowly rotate one turn clockwise over 3 seconds
         c.rotateBy(360, 3).rotateBy(-360, 3);
         
        Parameters:
        angle - the relative angle to rotate to in degrees.
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • moveBy

        default AnimationBuilder moveBy​(int x,
                                        int y,
                                        double duration)
        Move this by the specified x and y over duration seconds.
        
         Circle c = new Circle(200, 200, 50);
         // the circle will slowly move down 100 over 3 seconds
         // then, slowly move right over 3 seconds
         c.moveBy(0, 100, 3).moveBy(200, 0, 3);
         
        Parameters:
        x - the x to move by
        y - the y to move by
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • moveHorizontalBy

        default AnimationBuilder moveHorizontalBy​(int x,
                                                  double duration)
        Move this by the specified x horizontally over duration seconds. Positive values move right, negative values move left. This method is equivalent to moveBy(x, 0, duration)
        
         Circle c = new Circle(200, 200, 50);
         // the circle will move slowly right 300 pixels over 3 seconds
         c.moveHorizontalBy(100, 3);
         
        Parameters:
        x - the x to move by
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder
      • moveVerticalBy

        default AnimationBuilder moveVerticalBy​(int y,
                                                double duration)
        Move this by the specified y vertically over duration seconds. Positive values move down, negative values move up. This method is equivalent to moveBy(0, y, duration)
        
         Circle c = new Circle(200, 200, 50);
         // the circle will move right 300 pixels over 3 seconds
         c.moveVerticalBy(100, 3);
         
        Parameters:
        y - the y to move by
        duration - the number of seconds it lasts
        Returns:
        an AnimationBuilder