/tap-web-sdk:tap-dpadfrom tap-web-sdk
Build a D-Pad style controller with TapSDKWeb2 - swipes for directions, short pinches to select, pinch-hold that locks into rotate (twist) or drag (move) mode, fist-hold to hide. Use for D-Pad, menu navigation, select and move, drag and drop, rotate objects, or game controls with gestures.
Ships in tap-web-sdk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
TapSDKWeb2 only (framed firmware: TapXR developer firmware and TapBand). It needs raw air gestures and IMU motion. This is an app recipe that builds click / drag / drop in the page from those raw codes. iOS and Android add a processed layer in the native SDK; this Web SDK does not. Never say swipes or pinches are iOS/Android-only.
This is the same interaction as the D-Pad page in the TAP_EV sandbox (https://tapwithus.github.io/TAP_EV/).
| User does | Codes | Event |
|---|---|---|
| Swipe left / right / up / down | 101-104 | ["direction", "left"] ... |
| Short pinch thumb + index / middle / ring / pinky | 105-108 (AB-AE) | ["pinch", 0..3] (only when nothing is held) |
| Hold a pinch | 110-113 | ["hold", i], mode pending |
| ...and twist 25° or more within 1 s | IMU roll | ["mode", "rotate"], then ["rotate", degrees] |
| ...and do not twist | - | after 1 s ["mode", "drag"], then ["drag", dx, dy] |
| Relax the hand | 4 x 100 (NONE) | ["release", i]: snap back or drop the item |
| Hold a fist | 114 | ["hide"]; then 2 x NONE gives ["show"] |
Repeats of the same code within 40 ms are ignored (gesture packets stream continuously).
stateDiagram-v2
idle --> pending: pinch hold
pending --> rotate: roll travel >= 25 deg
pending --> drag: 1 s without enough roll
rotate --> idle: 4 x NONE
drag --> idle: 4 x NONE
idle --> hidden: fist hold
hidden --> idle: 2 x NONE
Copy scripts/dpad.ts. DpadStateMachine is pure logic, with no Bluetooth. All methods take now in seconds (performance.now() / 1000) and return a list of event arrays.
onGesture(code, now): feed air-gesture codes.onMotion(dx, dy, roll, now): feed IMU motion.tick(now): optional. It locks drag mode on time if motion packets stop.held, mode, hidden: current state for drawing the UI.Required device setup after connect() and after you register callbacks. connect() already started notifications. There is no start().
await sdk.setFeature(DeviceFeatures.MODEL_DETECTION, true);
await sdk.setVisionSensorModel(ModelTypes.AIR_GESTURE);
await sdk.setVisionSensorOpMode(VisionSensorOpModes.STREAM);
await sdk.setFeature(DeviceFeatures.IMU_MOTION_DATA, true);
If connect() returns TapSDKWeb (classic firmware), tell the user this recipe needs framed firmware (TapSDKWeb2): TapXR developer firmware, or TapBand when it ships. Do not say the device is unsupported.
const dpad = new DpadStateMachine();
function onAirGesture(_identifier: string, data: number[]): void {
const events = dpad.onGesture(data[0], performance.now() / 1000);
for (const event of events) {
if (event[0] === 'hold' || event[0] === 'mode' || event[0] === 'pinch') {
void sdk.sendVibrationSequence([40]);
}
}
}
function onMotion(_identifier: string, motion: ImuMotionData): void {
const [dx, dy, , [roll]] = motion;
const events = dpad.onMotion(dx, dy, roll, performance.now() / 1000);
draw(events);
}
| Argument | Default | Effect |
|---|---|---|
rotateLockDeg | 25 | Roll travel needed to choose rotate. Raise it if drag is chosen too rarely. |
lockWindowS | 1 | Time to decide between rotate and drag. |
releaseAfter | 4 | NONE packets before release. |
showAfter | 2 | NONE packets after a fist before showing again. |
debounceS | 0.04 | Ignore repeats of the same code in this window. |
drag deltas are raw device units. Multiply by a gain (TAP_EV uses about 0.45 px per unit) and clamp to the screen.rotate gives degrees relative to the start of the hold. TAP_EV multiplies by 1.8 for a stronger visual turn.["release", i] (TAP_EV does this).See also tap-knob (hold + twist for values) and tap-vision-models (gesture codes).
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tapwithus/tap-web-sdk --plugin tap-web-sdk8 skills in this plugin
/tap-build-an-appBuild a complete browser app or interactive experience controlled by a Tap - games, pages, presentations, or creative tools. Use when the user asks to build, make, or create something with their Tap, especially if they are not a developer./tap-getting-startedFirst skill for any Tap web app. Call connect() from a button click, then register callbacks, then enable input. connect() starts notifications. There is no start(). Use for install, connect to my Tap, setup, or no tap events./tap-imu-motionUse Tap hand motion - TapSDKWeb2 IMU motion data (dx, dy, roll, pitch, yaw) and TapSDKWeb mouse events - to move a cursor, steer, tilt, or rotate things. Use for air mouse, pointer, cursor control, tilt, orientation, euler angles, roll/pitch/yaw, or motion-driven UI.Other plugins' skills for the same job