Vibration API
Control device vibration hardware to provide haptic feedback. Create simple pulses or complex vibration patterns for enhanced user experience on mobile devices.
Device Support
Basic Vibration
Create a simple vibration with a single command. This example shows how to make a device vibrate for a specific duration, perfect for quick feedback like confirming a button press or alerting users to an important notification.
Output
Click Run to see output...
Vibration Patterns
Create rhythmic vibration sequences that communicate meaning. This example demonstrates how to design patterns like SOS or heartbeats by alternating vibration and pause durations, which can be used to convey different types of notifications or enhance gaming experiences.
Output
Click Run to see output...
Vibration Control
Start and stop vibrations on demand to create responsive experiences. This example shows how to manage ongoing vibrations by canceling them when needed, which is essential for games, timers, or any interactive feature where the user's actions should immediately affect the tactile feedback.
Output
Click Run to see output...