The Vibes class drives the watch's vibration motor, letting your Alloy app
provide haptic feedback. It offers a set of standard pulses as well as
custom vibration patterns.
Platform Support: Vibration is available on Emery (Pebble Time 2) and Gabbro (Pebble Time 2 round).
import Vibes from "pebble/vibes";
Vibes.shortPulse();
Vibes.longPulse();
Vibes.doublePulse();
| Method | Description |
|---|---|
Vibes.shortPulse() |
A single short vibration. |
Vibes.longPulse() |
A single long vibration. |
Vibes.doublePulse() |
Two short vibrations. |
Pass an array of millisecond durations to pattern(). Durations alternate
between on and off, starting with on:
import Vibes from "pebble/vibes";
// on 100ms, off 100ms, on 150ms, off 50ms, on 50ms, off 150ms, on 1000ms
Vibes.pattern([100, 100, 150, 50, 50, 150, 1000]);
Stop any ongoing vibration immediately:
Vibes.cancel();
Note: Vibration draws power and can be disruptive. Use it sparingly, and respect the user's Quiet Time settings for non-essential feedback.
See the
hellovibes example
for a complete project.