Class Flow


  • public class Flow
    extends java.lang.Object
    Flow for the mouse movement Flow defines how slow or fast the cursor is moving at a particular moment, defining the characteristics of movement itself not the trajectory, but how jagged or smooth, accelerating or decelerating, the movement is.
    • Constructor Summary

      Constructors 
      Constructor Description
      Flow​(double[] characteristics)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double[] getFlowCharacteristics()  
      double getStepSize​(double distance, int steps, double completion)
      This returns step size for a single axis.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Flow

        public Flow​(double[] characteristics)
        Parameters:
        characteristics - the characteristics array, which can be any size, contain non-negative numbers. The values in the array are translated to flow and all values are relative. For example an array of [1,2,3,4] has the same meaning as [100, 200, 300, 400] or [10, 10, 20, 20, 30, 30, 40, 40] Every array element describes a time of the movement, so that in array of n-elements every element is describing (100 / n)% of the movement. In an array of [1,2,3,4] every element is responsible for 25% of time and the movement is accelerating - in the last 25% of time the mouse cursor is 4 times faster than it was in the first 25% of the time.
    • Method Detail

      • getFlowCharacteristics

        public double[] getFlowCharacteristics()
      • getStepSize

        public double getStepSize​(double distance,
                                  int steps,
                                  double completion)
        This returns step size for a single axis.
        Parameters:
        distance - the total distance current movement has on current axis from beginning to target in pixels
        steps - number of steps the current movement involves
        completion - value between 0 and 1, the value describes movement completion in time
        Returns:
        the step size which should be taken next