Utility class for extra vibration functions.

Static variables

staticamplitudeTween:FlxTween

Tween that is used in increasingVibrate function for tweening vibration amplitude.

staticread onlydefaultVibrationPreset:VibrationPreset

A default vibration preset.

staticread onlyhapticsAvailable:Bool

Indicates if haptics are available.

Static methods

@:value({ tweenDuration : 1 })staticincreasingVibrate(startAmplitude:Float, targetAmplitude:Float, tweenDuration:Float = 1):Void

Triggers a queue of small vibrations with increasing amplitude. When the amplitudeTween is finished, triggers a single strong vibration.

Parameters:

startAmplitude

Start amplitude value.

targetAmplitude

Target amplitude value.

tweenDuration

Duration of the tween.

@:value({ sharpness : Constants.DEFAULT_VIBRATION_SHARPNESS, amplitude : Constants.DEFAULT_VIBRATION_AMPLITUDE, duration : Constants.DEFAULT_VIBRATION_DURATION, period : Constants.DEFAULT_VIBRATION_PERIOD })staticvibrate(period:Float = Constants.DEFAULT_VIBRATION_PERIOD, duration:Float = Constants.DEFAULT_VIBRATION_DURATION, amplitude:Float = Constants.DEFAULT_VIBRATION_AMPLITUDE, sharpness:Float = Constants.DEFAULT_VIBRATION_SHARPNESS, ?targetHapticsModes:Array<HapticsMode>):Void

Triggers vibration.

Parameters:

period

The time for one complete vibration in seconds.

duration

The time taken for a complete cycle in seconds.

amplitude

The intensity of the vibration (0.0 to 1.0).

sharpness

Controls the feel of vibration.

@:value({ vibrationPreset : null })staticvibrateByPreset(?vibrationPreset:Null<VibrationPreset>):Void

Triggers vibration using a preset.

Parameters:

vibrationPreset

Vibration's data.