gesture-custom
Send a sequence of touch events to perform complex gestures like long press, drag-and-drop, or custom scroll. Supports two-finger gestures and automatic interpolation for smooth movements.
Instructions
Send a sequence of touch events for complex gestures. Use for: long press, drag-and-drop, custom scroll, pinch (second touch point). For simple taps use the gesture-tap tool. For straight-line scrolling use the gesture-swipe tool. For pinch gestures use gesture-pinch. For rotation gestures use gesture-rotate. All x/y values are normalized 0.0–1.0 (screen fractions, not pixels). delayMs controls the delay before each event (default 16ms ≈ 60fps). Set interpolate to auto-generate smooth intermediate Move events between your keyframes. Returns { events: number } with the total count of events dispatched. Fails if the target device is not booted or an event type is invalid.
Example long-press at center: [{"type":"Down","x":0.5,"y":0.5},{"type":"Up","x":0.5,"y":0.5,"delayMs":800}]
Example smooth scroll down: [{"type":"Down","x":0.5,"y":0.7}, {"type":"Move","x":0.5,"y":0.6},{"type":"Move","x":0.5,"y":0.5},{"type":"Move","x":0.5,"y":0.4}, {"type":"Up","x":0.5,"y":0.3}]
Example pinch-to-zoom (with interpolate:10 for smoothness): events: [{"type":"Down","x":0.4,"y":0.5,"x2":0.6,"y2":0.5}, {"type":"Up","x":0.2,"y":0.5,"x2":0.8,"y2":0.5}] interpolate: 10
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Target device id from `list-devices` (iOS UDID or Android serial). | |
| events | Yes | Sequence of touch events; x/y (and optional second touch) are normalized 0.0–1.0, not pixels | |
| interpolate | No | Number of intermediate Move events to auto-insert between each pair of consecutive events. Smooths out gestures by linearly interpolating both primary (x,y) and secondary (x2,y2) coordinates. The delay is split evenly across interpolated frames. Default: no interpolation. |