Module MaterialFX

Class TransitionPositionBean

java.lang.Object
io.github.palexdev.materialfx.beans.PositionBean
io.github.palexdev.materialfx.beans.TransitionPositionBean

public class TransitionPositionBean extends PositionBean
This is an extension of PositionBean to be used with Transitions that start from a point P(x, y) and end at a point P1(endX, endY).

A very basic example:

Let's say I want to move a point P from (x, y) to the left (x1, y) with an animation. The transition would probably look like this:

 
     double startX = ...;
     double startY = ...;
     double endX = ...;
     double endY = startY; // The y coordinate doesn't change so it is equal to the start one
     TransitionPositionBean position = TransitionPositionBean.of(startX, startY, endX, endY);
     Transition move = new Transition() {
             @Override
             protected void interpolate(double frac) {
                 p.setX(x - position.deltaX() * frac);
             }
      }
 
 
  • Constructor Details

    • TransitionPositionBean

      public TransitionPositionBean(double x, double y, double endX, double endY)
  • Method Details

    • of

      public static TransitionPositionBean of(double x, double y, double endX, double endY)
    • getEndX

      public double getEndX()
      Returns:
      the end x coordinate
    • getEndY

      public double getEndY()
      Returns:
      the end y coordinate
    • deltaX

      public double deltaX()
      Returns:
      the difference between the star x and end x coordinates
    • deltaY

      public double deltaY()
      Returns:
      the difference between the start y and end y coordinates