Haptic
DSL function to emit a vibration event
Haptic
Module: jindong-compose | Package: io.github.compose.jindong.dsl
Emits a vibration event for the specified duration.
Signature
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
duration | Duration | - | How long the vibration lasts |
intensity | HapticIntensity | MEDIUM | Vibration strength |
Description
Haptic creates a single vibration event in the haptic pattern. The event is scheduled relative to previous events in the pattern.
Usage
Basic Usage
With Intensity
Custom Intensity
Sequential Haptics
Events run one after another:
With Delays
Examples
Single Tap Feedback
Double Tap Pattern
Success Feedback
Fade Out
Platform Behavior
| Platform | Implementation |
|---|---|
| Android | VibrationEffect.createOneShot() |
| iOS | CHHapticEvent with HapticTransient or HapticContinuous |
Notes
- Duration is the haptic event length, not a delay
- Events are sequential by default
- Use
Delayto add gaps between haptics - Intensity values are normalized (0.0 to 1.0)