Name | Type | Description |
---|---|---|
parent |
Sound |
The parent sound |
options |
SoundSpriteData |
Data associated with object. |
Example
import { sound } from '@pixi/sound';
sound.add('alias', {
url: 'path/to/file.ogg',
sprites: {
blast: { start: 0, end: 0.2 },
boom: { start: 0.3, end: 0.5 },
},
loaded() {
sound.play('alias', 'blast');
}
);
Members
The duration of the sound in seconds.
The ending location in seconds
Whether to loop the sound sprite.
parent Sound readonly
The reference sound
The speed override where 1 is 100% speed playback.
The starting location in seconds.
Methods
Destroy and don't use after this
play (complete) IMediaInstance | IMediaInstance<Promise>
Play the sound sprite.
Name | Type | Attributes | Description |
---|---|---|---|
complete |
Function |
<optional> |
Function call when complete |
Returns:
Type | Description |
---|---|
IMediaInstance | IMediaInstance<Promise> | Sound instance being played. |