Skip to content

Commit 433d9dd

Browse files
committed
gonna need a clock
1 parent ff70432 commit 433d9dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/classes/ThreeCanvas/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ class ThreeCanvas {
1818
private composer: THREE.Composer;
1919
private camera: THREE.Camera;
2020
private cubeGroup: THREE.Group;
21+
private clock: THREE.Clock;
2122

2223
constructor(options: IOptions) {
2324
const { mountPoint, width, height } = options;
2425

2526
// this is just here for reference. most of this file should be overwritten :)
2627

2728
// basics
29+
const clock = this.clock = new THREE.Clock();
2830
const scene = new THREE.Scene();
2931
const camera = this.camera = new THREE.PerspectiveCamera( 75, width / height, 0.1, 1000 );
3032
const renderer = this.renderer = new THREE.WebGLRenderer({
@@ -106,6 +108,8 @@ class ThreeCanvas {
106108
this.camera.updateProjectionMatrix();
107109
}
108110

111+
this.cubeGroup.rotation.y = this.clock.getElapsedTime();
112+
109113
this.composer.render();
110114
}
111115
}

0 commit comments

Comments
 (0)