Envelope
class Envelope
| kotlin.Any | |
| ↳ | 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 | |
|---|---|
|
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(builder: VibrationEffect.BasicEnvelopeBuilder)Creates a new haptic |
| static VibrationEffect.Envelope |
Creates a new haptic |
Public methods
create
static fun create(builder: VibrationEffect.BasicEnvelopeBuilder): VibrationEffect.Envelope
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. |
| Return | |
|---|---|
VibrationEffect.Envelope |
The created Envelope. This value cannot be null. |
create
static fun create(builder: VibrationEffect.WaveformEnvelopeBuilder): VibrationEffect.Envelope
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. |
| Return | |
|---|---|
VibrationEffect.Envelope |
The created Envelope. This value cannot be null. |