Class AnimationCurveControlPoint

java.lang.Object
yearreview.app.animation.AnimationCurveControlPoint

public class AnimationCurveControlPoint extends Object
A Control point used in the Creation of an AnimationCurve.
Author:
ColdStone37
  • Field Details

    • pos

      public final Vector2D pos
      Position of the Control-Point.
    • dir

      public final Vector2D dir
      Direction of the Control-Point. The x-value of this vector will always be positive.
  • Constructor Details

    • AnimationCurveControlPoint

      public AnimationCurveControlPoint(Vector2D pos, Vector2D dir)
      Constructs a Control-Point from a position and direction. If the direction has a negative x-value the direction-vector will be inverted.
      Parameters:
      pos - position of the Control-Point
      dir - direction of the Control-Point
    • AnimationCurveControlPoint

      public AnimationCurveControlPoint(Vector2D pos)
      Constructs a Control-Point from a position. The resulting Control-Point will not have a direction/handle.
      Parameters:
      pos - position of the Control-Point
    • AnimationCurveControlPoint

      public AnimationCurveControlPoint(float x, float y, float dx, float dy)
      Constructs a Control-Point from a position and direction.
      Parameters:
      x - x-coordinate of the Control-Point
      y - y-coordinate of the Control-Point
      dx - x-direction of the Control-Point
      dy - y-direction of the Control-Point
    • AnimationCurveControlPoint

      public AnimationCurveControlPoint(float x, float y)
      Constructs a Control-Point from a position.
      Parameters:
      x - x-coordinate of the Control-Point
      y - y-coordinate of the Control-Point
  • Method Details

    • hasHandle

      public boolean hasHandle()
      Whether this ControlPoint has a direction/handle.
      Returns:
      true if the ControlPoint has a direction, false otherwise
    • constructBezierBetween

      protected static BezierCurve constructBezierBetween(AnimationCurveControlPoint p1, AnimationCurveControlPoint p2)
      Constructs a Bezier between two Control-Points.
      Parameters:
      p1 - start of Bezier
      p2 - end of Bezier
      Returns:
      Bezier Curve from p1 to p2
    • toString

      public String toString()
      Outputs a text representation of the Control-Point. (e.g. "pos: (0.1, 0.3) dir: (0.5, 0.75)")
      Overrides:
      toString in class Object
      Returns:
      text representation of Control-Points