次の方法で共有


VibrationEffect.CreateWaveform Method

Definition

Overloads

CreateWaveform(Int64[], Int32)

Create a waveform vibration, using only off/on transitions at the provided time intervals, and potentially repeating.

CreateWaveform(Int64[], Int32[], Int32)

Create a waveform vibration.

CreateWaveform(Int64[], Int32)

Create a waveform vibration, using only off/on transitions at the provided time intervals, and potentially repeating.

[Android.Runtime.Register("createWaveform", "([JI)Landroid/os/VibrationEffect;", "", ApiSince=26)]
public static Android.OS.VibrationEffect? CreateWaveform (long[]? timings, int repeat);
[<Android.Runtime.Register("createWaveform", "([JI)Landroid/os/VibrationEffect;", "", ApiSince=26)>]
static member CreateWaveform : int64[] * int -> Android.OS.VibrationEffect

Parameters

timings
Int64[]

The pattern of alternating on-off timings, starting with an 'off' timing, and representing the length of time to sustain the individual item (not cumulative).

repeat
Int32

The index into the timings array at which to repeat, or -1 if you don't want to repeat indefinitely.

Returns

The desired effect.

Attributes

Remarks

Create a waveform vibration, using only off/on transitions at the provided time intervals, and potentially repeating.

In effect, the timings array represents the number of milliseconds <em>before</em> turning the vibrator on, followed by the number of milliseconds to keep the vibrator on, then the number of milliseconds turned off, and so on. Consequently, the first timing value will often be 0, so that the effect will start vibrating immediately.

This method is equivalent to calling #createWaveform(long[], int[], int) with corresponding amplitude values alternating between 0 and #DEFAULT_AMPLITUDE, beginning with 0.

To cause the pattern to repeat, pass the index into the timings array at which to start the repetition, or -1 to disable repeating. Repeating effects will be played indefinitely and should be cancelled via Vibrator#cancel().

Java documentation for android.os.VibrationEffect.createWaveform(long[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CreateWaveform(Int64[], Int32[], Int32)

Create a waveform vibration.

[Android.Runtime.Register("createWaveform", "([J[II)Landroid/os/VibrationEffect;", "", ApiSince=26)]
public static Android.OS.VibrationEffect? CreateWaveform (long[]? timings, int[]? amplitudes, int repeat);
[<Android.Runtime.Register("createWaveform", "([J[II)Landroid/os/VibrationEffect;", "", ApiSince=26)>]
static member CreateWaveform : int64[] * int[] * int -> Android.OS.VibrationEffect

Parameters

timings
Int64[]

The timing values, in milliseconds, of the timing / amplitude pairs. Timing values of 0 will cause the pair to be ignored.

amplitudes
Int32[]

The amplitude values of the timing / amplitude pairs. Amplitude values must be between 0 and 255, or equal to #DEFAULT_AMPLITUDE. An amplitude value of 0 implies the motor is off.

repeat
Int32

The index into the timings array at which to repeat, or -1 if you don't want to repeat indefinitely.

Returns

The desired effect.

Attributes

Remarks

Create a waveform vibration.

Waveform vibrations are a potentially repeating series of timing and amplitude pairs, provided in separate arrays. For each pair, the value in the amplitude array determines the strength of the vibration and the value in the timing array determines how long it vibrates for, in milliseconds.

To cause the pattern to repeat, pass the index into the timings array at which to start the repetition, or -1 to disable repeating. Repeating effects will be played indefinitely and should be cancelled via Vibrator#cancel().

Java documentation for android.os.VibrationEffect.createWaveform(long[], int[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to