Skip to content

Conversation

@tatsmaki
Copy link
Contributor

Related issue: #32482

Description

Added audio volume fading functionality using setTargetAtTime and cancelScheduledValues.

It is also possible to use linearRampToValueAtTime or exponentialRampToValueAtTime for precise transition control, however there is limited Chrome Android / WebView support.

TODO:

  • Add tests
  • Update docs

* @param {number} [volumeThen=0] - The volume at the end of the fade.
* @return {Audio} A reference to this instance.
*/
fadeOut( duration, volumeThen = 0 ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not think of a use case when fadeOut should start not from the current volume

@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 355.12
84.44
355.12
84.44
+0 B
+0 B
WebGPU 616.54
171.12
616.54
171.12
+0 B
+0 B
WebGPU Nodes 615.14
170.85
615.14
170.85
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 487.3
119.32
487.3
119.32
+0 B
+0 B
WebGPU 687.29
186.66
687.29
186.66
+0 B
+0 B
WebGPU Nodes 637.13
173.88
637.13
173.88
+0 B
+0 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant