Skip to content

Commit eeec0f4

Browse files
authored
Docs: Properly document animation loop parameter. (#31853)
1 parent 1892468 commit eeec0f4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,13 @@ class WebGLRenderer {
14921492

14931493
if ( typeof self !== 'undefined' ) animation.setContext( self );
14941494

1495+
/**
1496+
* Applications are advised to always define the animation loop
1497+
* with this method and not manually with `requestAnimationFrame()`
1498+
* for best compatibility.
1499+
*
1500+
* @param {?onAnimationCallback} callback - The application's animation loop.
1501+
*/
14951502
this.setAnimationLoop = function ( callback ) {
14961503

14971504
onAnimationFrameCallback = callback;

src/renderers/common/Renderer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ class Renderer {
16171617
* for best compatibility.
16181618
*
16191619
* @async
1620-
* @param {?Function} callback - The application's animation loop.
1620+
* @param {?onAnimationCallback} callback - The application's animation loop.
16211621
* @return {Promise} A Promise that resolves when the set has been executed.
16221622
*/
16231623
async setAnimationLoop( callback ) {
@@ -3114,4 +3114,12 @@ class Renderer {
31143114

31153115
}
31163116

3117+
/**
3118+
* Animation loop parameter of `renderer.setAnimationLoop()`.
3119+
*
3120+
* @callback onAnimationCallback
3121+
* @param {DOMHighResTimeStamp} time - A timestamp indicating the end time of the previous frame's rendering.
3122+
* @param {XRFrame} [frame] - A reference to the current XR frame. Only relevant when using XR rendering.
3123+
*/
3124+
31173125
export default Renderer;

0 commit comments

Comments
 (0)