Changing and Animating Colors
After all the movement coding that we just did, how about we take a step back and do something a little different - color using Three.js. Remember the rgb (red, green, and blue) line of code that made the cube a bright green? Just in case, here it is again: var material = new THREE.MeshBasicMaterial({ color: 'rgb(0,255,0)' }); The three numbers inside the rgb code parentheses, (0,255,0) represent the intensity of each component of the overall final color. We have 0 for red, 255 for green,and 0 for blue. Remember that 255 is the maximum value for a color code. Since we have 0 for both red and blue, they will not be mixed into the final color. And since we have the maximum 255 for green, our cube turns out to be the brightest green possible. Let's have a little fun with the color values. First, try replacing the number 255 with a lower number, like 50. Since this is a lower intensity, it will still be green, but...