A position and movement settings for one step of a swipe. Pass a list of at least two SwipePoint objects to swipe([...]) to move one finger through those positions.
Syntax
SwipePoint(point, speed="NORMAL", delay_before=0, random=10, humanized=False, scale="fixed", anchor="none")Constructor parameters
| Name | Description |
|---|---|
pointPoint | tuple[Number, Number] | A Point or (x, y) tuple in pixels. Keeps the Point's scale and anchor unless explicitly overridden here. Required · Positional or named No default |
speedString | Movement speed from this point to the next: VERY_SLOW, SLOW, NORMAL, FAST, VERY_FAST. Optional · Positional or named Default: NORMAL |
delay_beforeNumber | Delay in milliseconds; negative values become 0. With parallel=False, wait before starting at the first point or after reaching a later point. Parallel swipes use only the first point's delay. Optional · Positional or named Default: 0 |
randomNumber | Maximum random displacement in pixels on each axis; 0 uses the exact position. Negative values become 0. Optional · Positional or named Default: 10 |
humanizedBoolean | Use a curved path for the whole swipe if any SwipePoint has humanized=True. Optional · Positional or named Default: False |
scaleString | Coordinate scaling as on Point: fixed, auto, width, height. Inherits from point unless supplied. Optional · Positional or named Default: fixed |
anchorString | Optional · Positional or named Default: none |
Returns
Example
# Two parallel fingers, each finger is one flat path
Touch.collect()
left = swipe([
SwipePoint(Point(300, 1500), speed="FAST"),
SwipePoint(Point(300, 500))
], parallel=True)
right = swipe([
SwipePoint(Point(780, 1500), speed="FAST"),
SwipePoint(Point(780, 500))
], parallel=True)
Touch.send()
Touch.wait()Fields
| Name | Description |
|---|---|
pointPoint | The swipe position in pixels, including its scale and anchor settings. |
speedString | Movement speed from this point to the next: VERY_SLOW, SLOW, NORMAL, FAST, VERY_FAST. Default: NORMAL |
delay_beforeNumber | Delay in milliseconds; negative values become 0. With parallel=False, wait before starting at the first point or after reaching a later point. Parallel swipes use only the first point's delay. Default: 0 |
randomNumber | Maximum random displacement in pixels on each axis; 0 uses the exact position. Negative values become 0. Default: 10 |
humanizedBoolean | Use a curved path for the whole swipe if any SwipePoint has humanized=True. Default: False |
scaleString | Coordinate scaling as on Point: fixed, auto, width, height. Inherits from point unless supplied. Default: fixed |
anchorString | Default: none |
Constructor example
path = [
SwipePoint(Point(500, 1500), speed="FAST"),
SwipePoint((560, 980), speed="NORMAL", humanized=True),
SwipePoint(Point(500, 500))
]
swipe(path)