@@ -180,21 +180,23 @@ function createApp(gl, settings) {
180180
181181 twgl . resizeCanvasToDisplaySize ( gl . canvas ) ;
182182
183- // Make the camera rotate around the scene.
184- eyePosition [ 0 ] = Math . sin ( clock * g_eyeSpeed ) * g_eyeRadius ;
185- eyePosition [ 1 ] = g_eyeHeight ;
186- eyePosition [ 2 ] = Math . cos ( clock * g_eyeSpeed ) * g_eyeRadius ;
183+ if ( settings . update ) {
184+ // Make the camera rotate around the scene.
185+ eyePosition [ 0 ] = Math . sin ( clock * g_eyeSpeed ) * g_eyeRadius ;
186+ eyePosition [ 1 ] = g_eyeHeight ;
187+ eyePosition [ 2 ] = Math . cos ( clock * g_eyeSpeed ) * g_eyeRadius ;
187188
188- // --Update Instance Positions---------------------------------------
189- var advance = elapsedTime / 2 ;
190- for ( var ii = 0 ; ii < g_numObjects ; ++ ii ) {
191- var instance = instances [ ii ] ;
192- instance . xClock += advance * instance . xClockSpeed ;
193- instance . yClock += advance * instance . yClockSpeed ;
194- instance . zClock += advance * instance . zClockSpeed ;
195- instance . x = Math . sin ( instance . xClock ) * instance . xRadius ;
196- instance . y = Math . sin ( instance . yClock ) * instance . yRadius ;
197- instance . z = Math . cos ( instance . zClock ) * instance . zRadius ;
189+ // --Update Instance Positions---------------------------------------
190+ const advance = elapsedTime / 2 ;
191+ for ( let ii = 0 ; ii < g_numObjects ; ++ ii ) {
192+ var instance = instances [ ii ] ;
193+ instance . xClock += advance * instance . xClockSpeed ;
194+ instance . yClock += advance * instance . yClockSpeed ;
195+ instance . zClock += advance * instance . zClockSpeed ;
196+ instance . x = Math . sin ( instance . xClock ) * instance . xRadius ;
197+ instance . y = Math . sin ( instance . yClock ) * instance . yRadius ;
198+ instance . z = Math . cos ( instance . zClock ) * instance . zRadius ;
199+ }
198200 }
199201 }
200202
0 commit comments