Class MotionFactory


  • public class MotionFactory
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MotionFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<MotionFactory.TimedPoint> transform​(NormalizedPath template, net.runelite.api.Point start, net.runelite.api.Point end, long duration)
      Transforms a normalized path into a real-world path by scaling, rotating, translating, and timing its points based on the given start and end coordinates and the duration of the motion.
      • Methods inherited from class java.lang.Object

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

      • MotionFactory

        public MotionFactory()
    • Method Detail

      • transform

        public static java.util.List<MotionFactory.TimedPoint> transform​(NormalizedPath template,
                                                                         net.runelite.api.Point start,
                                                                         net.runelite.api.Point end,
                                                                         long duration)
        Transforms a normalized path into a real-world path by scaling, rotating, translating, and timing its points based on the given start and end coordinates and the duration of the motion.

        The transformation is achieved in the following steps:

        • Scaling: Scales the normalized coordinates to match the target distance between the start and end points.
        • Rotation: Rotates the points to align with the angle between the start and end points.
        • Translation: Translates the points to the starting position.
        • Timing: Maps the normalized time of each point to the provided duration.
        Parameters:
        template - The @link NormalizedPath containing the normalized unit points to be transformed. It defines the shape and time distribution of the motion path.
        start - The @link Point specifying the starting position of the motion.
        end - The @link Point specifying the ending position of the motion.
        duration - A long value representing the total duration of the motion in milliseconds.
        Returns:
        A List<TimedPoint> where each TimedPoint represents a point on the real-world motion path with x, y coordinates and an associated timestamp.