swipe
Simulate a finger-1 swipe between two positions.
js
swipe(x1, y1, x2, y2, duration = 0.3)Arguments
| Argument | Type | Meaning |
|---|---|---|
x1, y1 | number | Start in native screen pixels. |
x2, y2 | number | End in native screen pixels. |
duration | number | Seconds; default 0.3. |
Returns
No return value (undefined).
Example
js
const s = getScreenInfo();
const landscape = [3, 4].includes(frontMostAppOrientation());
const w = landscape ? s.height : s.width;
const h = landscape ? s.width : s.height;
swipe(w * 0.5, h * 0.75, w * 0.5, h * 0.3, 0.35);Notes
Verify the new screen afterward; fractional positions alone do not identify an app control.