How Does Device Vibration Work?
Mobile devices use a vibration motor — a small motor with an off-center weight that creates vibrations when it spins. Newer devices use linear resonant actuators (LRA) or Apple's Taptic Engine, which use electromagnetic forces to create more precise, nuanced vibrations. These can produce quick taps, gentle pulses, or complex patterns, enabling rich haptic feedback for notifications, gaming, and UI interactions.
Haptic Feedback in Modern UX
Haptic feedback has become a crucial part of user experience design. Confirmation haptics provide tactile confirmation for button presses (like iPhone's home button). Notification patterns let users identify alerts without looking at their device. Gaming haptics simulate impacts, engines, and environmental effects. Accessibility — haptic feedback helps visually impaired users interact with touchscreens more effectively.
Vibration API
The Vibration API (navigator.vibrate()) allows web pages to trigger device vibration. It accepts a single duration in milliseconds or an array of alternating vibrate/pause values for patterns. The API only works on mobile devices — desktop computers typically don't have vibration motors. It requires a secure context (HTTPS) and some browsers require user interaction before allowing vibration.