[MUSIC] It's difficult to perceive 3D objects on a 2D screen. For example, when displaying a 3D character A, it will appear like a 2D character A on a 2D screen. To view the 3D effect, we can rotate a 3D character A with a fixed angle to showcase a 3D shape. However, often a better alternative is to use animation to rotate the object around to visualize the 3D object shape. For example, it will be better to visualize the 3D character A by rotating the object around the y-axis like this. Let's look at how to do this. To enable an animation, we first modify the MyRenderer object and define a floating point a variable, mAngle, which represents that rotation angle. Then, in the onDrawFrame function, we modify the setRotateM function and set the angle parameter to mAngle. Afterwards, we add a new public function, setAngle in the MyRenderer object for setting the value of the mAngle. Hence, we can rotate the object about the y-axis by calling the setAngle function of the MyRenderer. We can create an animation by using a timer, which will call functions to update and draw objects on the screen periodically. This will provide an animated effect. We should put a timer in the MyView object. Therefore, we modify the MyView object to add a new timer to enable rotation. We start by adding the timer variable, then create a TimerTask. In the TimerTask, we define the variable angle and call the setAngle function of the MyRenderer to set the rotation angle. Then we call the requestRenderer to ask the renderer to update the display. To spin the object, we keep incrementing the angle by 1. We call the schedule at a fixed rate to trigger the timer every 10 milliseconds. Let's modify our example program to put this into practice. So first, in the MyRenderer, we add a variable mAngle. We initialize it to 0 first. And then modify the setRotation to use the mAngle to rotate about the y-axis. And then add a function setAngle. And then, we modify MyView object. Add a new timer. And also a TimerTask in which we will set the angle in myRenderer, and then request the renderer to update the screen. The angle increment by one degree every 10 milliseconds. So here's the result. Why do you think this approach would not work for an object like this? For this object, rotating around the y-axis will not work as it is symmetric around the y-axis. Hence, to see the 3D object shape, we have to rotate the object about the x- or z-axis. Can you modify the program to rotate this object around the both x- and y-axis? Have a go at this and view my example code in the next section once you have had a go. [MUSIC]