Skip to main content

SwipePoint()

Represents a point in a swipe path. Used with Screen:swipe() and Screen:multiSwipe() to define where the finger moves, how fast, and how long it pauses.

Constructor

SwipePoint(x, y, holdDuration, swipeDuration);

Parameters

ParameterTypeDefaultDescription
xnumberrequiredThe x coordinate in screen pixels
ynumberrequiredThe y coordinate in screen pixels
holdDurationnumber50How long in milliseconds to hold at this position
swipeDurationnumber2000Duration in milliseconds (meaning depends on position in the swipe list)

Parameter meaning depends on position

The swipeDuration and holdDuration parameters have different meanings depending on whether the SwipePoint is the first point or a subsequent point in the swipe list:

As the first point:

  • swipeDuration — Initial delay before the finger touches down (sleep)
  • holdDuration — Hold at the start position before moving

As a subsequent point:

  • swipeDuration — Duration to travel from the previous point to this point
  • holdDuration — Hold at this point after arriving

Example

-- Touch down at (500, 1000) after 1 second delay,
-- hold 50ms, then move to (500, 400) over 2 seconds
Screen:swipe({
SwipePoint(500, 1000, 50, 1000),
SwipePoint(500, 400, 50, 2000),
})

Notes

  • If swipeDuration is 0, it is treated as 1 ms (essentially instant)
  • If holdDuration is 0, there is no hold at that point