# Question about code in chapter 8: Everything Goes Gray

**URL:** <https://talk.code3dgames.com/t/question-about-code-in-chapter-8-everything-goes-gray/174>\
**Category:** Uncategorized\
**Created:** [December 31, 2019, 1:46am UTC](https://talk.code3dgames.com/t/question-about-code-in-chapter-8-everything-goes-gray/174 "2019-12-31T01:46:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_Bird50](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/j_bird50/32/25_2.png) [@J\_Bird50](https://talk.code3dgames.com/u/J_Bird50)\
**Post date:** [December 31, 2019, 1:46am UTC](https://talk.code3dgames.com/t/question-about-code-in-chapter-8-everything-goes-gray/174/1 "2019-12-31T01:46:31Z")

</div>

Hey Chris,  
I was working on the turn function in chapter 8 and I added the function.  
Then, I put ‘turn();’ in the requestAnimationFrame(animate) line and it went gray.

Code:  
function animate() {  
requestAnimationFrame(animate);  
walk();  
turn();  
acrobatics();  
renderer.render(scene, camera);  
}  
animate();

Turn Function:

function turn() {  
if (isMovingRight) direction = Math.PI/2;  
if (isMovingLeft) direction = -Math.PI/2;  
if (isMovingForward) direction = Math.PI;  
if (isMovingBack) direction = 0;  
if (!isWalking()) direction = 0;

avatar.rotation.y = direction;  
}

Thanks,  
Jakin

---

<div class="post-metadata">

**Author:** ![chris](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/chris/32/5_2.png) [@chris](https://talk.code3dgames.com/u/chris)\
**Post date:** [January 1, 2020, 4:54am UTC](https://talk.code3dgames.com/t/question-about-code-in-chapter-8-everything-goes-gray/174/2 "2020-01-01T04:54:50Z")

</div>

That code looks correct to me. So there must be an issue somewhere else in the code. Is it possible to share the entire project as described in the [welcome post](https://talk.code3dgames.com/t/welcome-to-3d-game-programming-for-kids-read-this-first/8)?

Also, if you haven’t already, be sure to check in the JavaScript console. The cause of the problem may already be showing up there.

-Chris
