Skip to content

Commit 948a169

Browse files
authored
Animation: Rename frame parameter to xrFrame. (#1545)
* Animation: Rename frame parameter to xrFrame. * Update three.js * Add src * Update patch and delete src * Update declarations * Add src * Update patch and delete src * Update declarations
1 parent 8b71f39 commit 948a169

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src-testing/changes.patch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,15 +3507,15 @@ index 096326f3..d1b6ae2e 100644
35073507

35083508
export const Fn = (jsFunc, nodeType) => {
35093509
diff --git a/src-testing/src/renderers/common/Animation.ts b/src-testing/src/renderers/common/Animation.ts
3510-
index 5f4e7775..0c490ad9 100644
3510+
index fe3f7743..92f9822a 100644
35113511
--- a/src-testing/src/renderers/common/Animation.ts
35123512
+++ b/src-testing/src/renderers/common/Animation.ts
35133513
@@ -1,16 +1,31 @@
35143514
+import Nodes from './nodes/Nodes.js';
35153515
+import Info from './Info.js';
35163516
+
35173517
+export interface AnimationContext {
3518-
+ requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
3518+
+ requestAnimationFrame(callback: FrameRequestCallback, xrFrame?: XRFrame): number;
35193519
+ cancelAnimationFrame(handle: number): void;
35203520
+}
35213521
+
@@ -3529,7 +3529,7 @@ index 5f4e7775..0c490ad9 100644
35293529
+ info: Info;
35303530
+
35313531
+ _context: AnimationContext;
3532-
+ _animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
3532+
+ _animationLoop: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
35333533
+ _requestId: number | null;
35343534
+
35353535
/**
@@ -3547,17 +3547,17 @@ index 5f4e7775..0c490ad9 100644
35473547
* Starts the internal animation loop.
35483548
*/
35493549
start() {
3550-
- const update = (time, frame) => {
3551-
+ const update = (time?: DOMHighResTimeStamp, frame?: XRFrame) => {
3550+
- const update = (time, xrFrame) => {
3551+
+ const update = (time?: DOMHighResTimeStamp, xrFrame?: XRFrame) => {
35523552
this._requestId = this._context.requestAnimationFrame(update);
35533553

35543554
if (this.info.autoReset === true) this.info.reset();
35553555
@@ -64,7 +79,7 @@ class Animation {
35563556

35573557
this.info.frame = this.nodes.nodeFrame.frameId;
35583558

3559-
- if (this._animationLoop !== null) this._animationLoop(time, frame);
3560-
+ if (this._animationLoop !== null) this._animationLoop(time!, frame);
3559+
- if (this._animationLoop !== null) this._animationLoop(time, xrFrame);
3560+
+ if (this._animationLoop !== null) this._animationLoop(time!, xrFrame);
35613561
};
35623562

35633563
update();
@@ -3575,7 +3575,7 @@ index 5f4e7775..0c490ad9 100644
35753575
* @param {Function} callback - The animation loop.
35763576
*/
35773577
- setAnimationLoop(callback) {
3578-
+ setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null) {
3578+
+ setAnimationLoop(callback: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null) {
35793579
this._animationLoop = callback;
35803580
}
35813581

@@ -6159,7 +6159,7 @@ index 7527627e..c0fcddf9 100644
61596159

61606160
/**
61616161
diff --git a/src-testing/src/renderers/common/Renderer.ts b/src-testing/src/renderers/common/Renderer.ts
6162-
index c0931ffb..c905c419 100644
6162+
index 52535a1c..dd128cfd 100644
61636163
--- a/src-testing/src/renderers/common/Renderer.ts
61646164
+++ b/src-testing/src/renderers/common/Renderer.ts
61656165
@@ -37,7 +37,35 @@ import {

types/three/src/renderers/common/Animation.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Info from "./Info.js";
22
import Nodes from "./nodes/Nodes.js";
33
export interface AnimationContext {
4-
requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
4+
requestAnimationFrame(callback: FrameRequestCallback, xrFrame?: XRFrame): number;
55
cancelAnimationFrame(handle: number): void;
66
}
77
/**
@@ -13,7 +13,7 @@ declare class Animation {
1313
nodes: Nodes;
1414
info: Info;
1515
_context: AnimationContext;
16-
_animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
16+
_animationLoop: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
1717
_requestId: number | null;
1818
/**
1919
* Constructs a new animation loop management component.
@@ -35,13 +35,13 @@ declare class Animation {
3535
*
3636
* @return {Function} The animation loop.
3737
*/
38-
getAnimationLoop(): ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
38+
getAnimationLoop(): ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
3939
/**
4040
* Defines the user-level animation loop.
4141
*
4242
* @param {Function} callback - The animation loop.
4343
*/
44-
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
44+
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null): void;
4545
/**
4646
* Returns the animation context.
4747
*

types/three/src/renderers/common/Renderer.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ declare class Renderer {
386386
*/
387387
getSize(target: Vector2): Vector2;
388388
/**
389-
* Sets the given pixel ration and resizes the canvas if necessary.
389+
* Sets the given pixel ratio and resizes the canvas if necessary.
390390
*
391391
* @param {number} [value=1] - The pixel ratio.
392392
*/

0 commit comments

Comments
 (0)