-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Open
Labels
Description
Description
In my projects I usually extend three Audio to add new functions like:
declare module "three" {
interface Audio {
fadeIn(volume: number, duration: number): void;
}
}THREE.Audio.prototype.fadeIn = function (volume, duration) {
const { currentTime } = this.listener.context;
this.gain.gain
.setValueAtTime(0, currentTime)
.linearRampToValueAtTime(volume, currentTime + duration);
};Do you think some basic audio gain/volume interpolation may fit the library?
Solution
Just wanted to know maintainers opinion on this before doing any PRs.
Cuz maybe you say this logic does not belong to three Audio and should be implemented on project basis
Alternatives
- extending prototype
- patch-package
- fork
Additional context
No response
Mugen87