VibrationEffect.Envelope


public static final class VibrationEffect.Envelope
extends Object

java.lang.Object
   ↳ android.os.VibrationEffect.Envelope


Represents a haptic effect defined by an envelope, to be used within a VibrationEffect.Builder.

This class encapsulates Piecewise Linear Envelope (PWLE) effects, which can be created using either the WaveformEnvelopeBuilder for direct amplitude and frequency control, or the BasicEnvelopeBuilder for a more perception-based approach using intensity and sharpness.

Envelopes are fundamental building blocks in the composition API, allowing for expressive and complex haptic effects by sequencing them with other elements like Presets.

Summary

Nested classes

class VibrationEffect.Envelope.BeatingEnvelopeBuilder

A builder to help users create rich and expressive beating vibrations, taking beats per second, vibration sharpness, and an amplitude scale envelope as input. 

Public methods

static VibrationEffect.Envelope create(VibrationEffect.WaveformEnvelopeBuilder builder)

Creates a new haptic Envelope from the provided WaveformEnvelopeBuilder.

static VibrationEffect.Envelope create(VibrationEffect.BasicEnvelopeBuilder builder)

Creates a new haptic Envelope from the provided BasicEnvelopeBuilder.

Inherited methods

Public methods

create

Added in API level 10000
public static VibrationEffect.Envelope create (VibrationEffect.WaveformEnvelopeBuilder builder)

Creates a new haptic Envelope from the provided WaveformEnvelopeBuilder.

Note: Envelopes created from WaveformEnvelopeBuilder do not support haptics fallback.

Parameters
builder VibrationEffect.WaveformEnvelopeBuilder: The builder used to define the envelope's waveform.
This value cannot be null.

Returns
VibrationEffect.Envelope The created Envelope.
This value cannot be null.

create

Added in API level 10000
public static VibrationEffect.Envelope create (VibrationEffect.BasicEnvelopeBuilder builder)

Creates a new haptic Envelope from the provided BasicEnvelopeBuilder.

Parameters
builder VibrationEffect.BasicEnvelopeBuilder: The builder used to define the envelope's basic parameters.
This value cannot be null.

Returns
VibrationEffect.Envelope The created Envelope.
This value cannot be null.