AndroidHaptics
| Kind | class |
| Package | android.platform |
| Full name | android.platform.AndroidHaptics |
| Source | source/android/platform/AndroidHaptics.hx |
Android vibration/haptic feedback for gameplay events, menu interactions and anything else the engine wants to make tactile.
Public methods
isSupported
static function isSupported():Bool
True when the device has a vibrator.
vibrate
static function vibrate(durationMs:Int = 50):Void
Single vibration burst.
| Parameter | Type | Default |
|---|---|---|
durationMs (optional) | Int | 50 |
vibratePattern
static function vibratePattern(pattern:Array<Int>, repeat:Int = -1):Void
Patterned vibration. @param pattern alternating wait/vibrate timings in ms, e.g. [0, 40, 60, 40] @param repeat pattern index to loop from, -1 for no repeat
| Parameter | Type | Default |
|---|---|---|
pattern | Array<Int> | — |
repeat (optional) | Int | -1 |
cancel
static function cancel():Void
Stops any in-flight vibration.
light
static inline function light():Void
Convenience presets for rhythm-game feedback.
medium
static inline function medium():Void
heavy
static inline function heavy():Void
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
_hasVibrator | Dynamic | yes |
_vibrate | Dynamic | yes |
_vibratePattern | Dynamic | yes |
_cancelVibration | Dynamic | yes |
| Method |
|---|
static function hasVibrator_jni():Bool |
static function vibrate_jni(durationMs:Int):Void |
static function vibratePattern_jni(patternCsv:String, repeat:Int):Void |
static function cancelVibration_jni():Void |