3D Animation : Moon Phases

moon-earthIn this blog post we will use Glowscript to create a 3D animation representing how we perceive the moon from Earth throughout its cycle.

Our aim is to represent a 3D sphere and to progressively change the direction of the light using a while loop. At each iteration of our while loop we will increment the angle of the light (theta) by a few radians (omega).

The full cycle means that the theta angle has completed a full circle (2*PI radians), representing 28 days.

We will start the cycle with a new moon (when the moon is not visible).

moon-phases

Here is our 3D animation: (Use Google Chrome to preview this animation)

Find out more…


To learn more about all the instructions you can use in GlowScript/VPython, use this on-line documentation.

Animate 3D Molecules


Check this blog post to see how you can use GlowScript to create and animate 3D molecules!

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with: , , ,

Our Latest Book

Follow this blog