Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Envelope

*** ** * ** ***

```
class Envelope
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.os.VibrationEffect.Envelope](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#) |

Represents a haptic effect defined by an envelope, to be used within a `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Builder`.

This class encapsulates Piecewise Linear Envelope (PWLE) effects, which can be created using either the `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.WaveformEnvelopeBuilder` for direct amplitude and frequency control, or the `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.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 `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Preset`s.

## Summary

| Public methods ||
|---|---|
| static [VibrationEffect.Envelope](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#) | `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#create(android.os.VibrationEffect.BasicEnvelopeBuilder)(builder: https://developer.android.com/reference/kotlin/android/os/VibrationEffect.BasicEnvelopeBuilder)` Creates a new haptic `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#` from the provided `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.BasicEnvelopeBuilder`. |
| static [VibrationEffect.Envelope](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#) | `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#create(android.os.VibrationEffect.WaveformEnvelopeBuilder)(builder: https://developer.android.com/reference/kotlin/android/os/VibrationEffect.WaveformEnvelopeBuilder)` Creates a new haptic `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#` from the provided `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.WaveformEnvelopeBuilder`. |

## Public methods

### create

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static fun create(builder: VibrationEffect.BasicEnvelopeBuilder): VibrationEffect.Envelope
```

Creates a new haptic `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#` from the provided `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.BasicEnvelopeBuilder`.

| Parameters ||
|---|---|
| `builder` | [VibrationEffect.BasicEnvelopeBuilder](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.BasicEnvelopeBuilder): The builder used to define the envelope's basic parameters. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#` | The created `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#`. This value cannot be `null`. |

### create

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static fun create(builder: VibrationEffect.WaveformEnvelopeBuilder): VibrationEffect.Envelope
```

Creates a new haptic `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#` from the provided `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.WaveformEnvelopeBuilder`.

Note: Envelopes created from `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.WaveformEnvelopeBuilder` do not support haptics fallback.

| Parameters ||
|---|---|
| `builder` | [VibrationEffect.WaveformEnvelopeBuilder](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.WaveformEnvelopeBuilder): The builder used to define the envelope's waveform. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#` | The created `https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Envelope#`. This value cannot be `null`. |