Below are some simple animations that I put together for for AST 105: Introduction to the Solar System, AST 203: Astronomy, and AST 205: Introduction to Planetary Sciences.

All of these are coded in python, using the matplotlib library for plotting. The source code is provided in each case. These codes are not meant to be interactive -- they simply dump out frames of the animation that can be assembled into a movie using a program like mencoder. This python script ( provides an easy interface to mencoder for stringing a bunch of PNGs into movies.

Note: all the codes and movies are now available on github

You are free to use these codes or animations for teaching purposes (please credit Michael Zingale). If you find a mistake or make an improvement, please send it along to Michael.Zingale @, or fork the github repo and issue a pull request.

Many of these animations are now up on YouTube:


Planetary Orbits and Kepler's Laws [HD]

Integrate the orbits of two planets around a star, neglecting the gravitational force between the planets themselves. This is useful for demonstrating Kepler's third law. We work in units of AU, years, and solar masses. The semi-major axes are picked such that one planet has an orbital period of 1 year and the other of 2 years.

As the animation plays, you should see that the speed of the outer planet varies, becoming fastest at perihelion and slowest a aphelion. You will also see that the outer planet takes longer to complete its orbit around the Sun, since P2 ~ a3.

Movie of orbits:
orbit2.avi [MS MPEG-4v2]
orbit2.mp4 [H.264]


Kepler's Second Law [HD]

Show equal areas in equal times, by shading the area swept out by a planet in equal time intervals.

second law animation:
second_law.avi [MS MPEG-4v2]
second_law.mp4 [H.264]

second law

Solar System Harmonic Law Figure

A simple figure plotting the period of planets (+ pluto optionally) in our solar system vs. semi-major axis on a log-log plot, showing the P2 ~ a3 relation. Optionally plot the Galilean moons of Jupiter on the same axes, showing that they obey a P2 ~ a3 relation as well, but with a different constant.

Harmonic law figure (just planets): harmonic_law.png
Harmonic law figure (planets + pluto + Galilean moons): harmonic_pluto_moons.png

harmonic law

Retrograde Motion [HD]

Integrate Earth and Mars in their orbits around the Sun, starting a bit before opposition, and draw a line indicating the line-of-sight to Mars from Earth against some background stars to show the change in apparent motion.

Note: the orbits are simplified here -- the semi-major axis and eccentricity are correct, but it is assumed that both ellipses are oriented the same way. For demonstration purposes, this is not all that critical.

Movie of retrograde motion:
retrograde.avi [MS MPEG-4v2]
retrograde.mp4 [H.264]


Parallax Animation [HD]

A simple animation showing how parallax works, illustrating the motion of the Earth around the Sun and the apparent shift seen in the position of a nearby star against the background, more distant stars.

Parallax animation:
parallax.avi [MS MPEG-4v2]
parallax.mp4 [H.264]


Mercury's rotation [HD]

Illustrate a 3:2 resonance between the rotation period and orbital period of Mercury. The semi-major axis and eccentricity for the planet drawn match Mercury. The black dot on the surface of the planet represents a person standing initially directly under the Sun at perihelion.

Mercury rotation animation:
mercury.avi [MS MPEG-4v2]
mercury.mp4 [H.264]

Mercury rotation

Moon's Synchronous Rotation [HD]

Illustrate the synchronous rotation of the Moon. The black dot represents a person standing on the surface. The orbit is taken to be circular, for simplicity.

Moon rotation animation:
moon_rotation.avi [MS MPEG-4v2]
moon_rotation.mp4 [H.264]

Moon rotation

Orbital Energy [HD]

A simple showing the orbit of a planet around the Sun, outputting the kinetic energy / unit mass, the potential energy / unit mass, and the total energy / unit mass along the way.

Orbital energy animation:
orbitalenergy.avi [MS MPEG-4v2]
orbitalenergy.mp4 [H.264]

orbital energy

Lunar Period [HD]

A simple animation showing how the time between successive full Moons (the synodic lunar period) is greater than the true (sidereal) orbital period of the Moon.

Orbital energy animation:
lunar_period.avi [MS MPEG-4v2]
lunar_period.mp4 [H.264]

lunar period

Sidereal vs. Solar Day (for Earth) [HD]

A simple animation showing how the true rotation period of Earth (the sidereal day) is shorter than the time between noons (the solar day).

Orbital energy animation:
earth.avi [MS MPEG-4v2]
earth.mp4 [H.264]

lunar period

Phases of the Moon [HD]

A simple animation showing the phases of the Moon and the corresponding point in the Moons orbit around the Earth, with respect to the Sun.

Phases animation:
lunar-phases.avi [MS MPEG-4v2]
lunar-phases.mp4 [H.264]

lunar period

Solstices and Equinox [HD]

A simple animation showing the Earth at either solstice or and equinox (with the time set as noon UTC).

Summer Solstice:
summer_solstice.avi [MS MPEG-4v2]
summer_solstice.mp4 [H.264]

Winter Solstice:
winter_solstice.avi [MS MPEG-4v2]
winter_solstice.mp4 [H.264]

equinox.avi [MS MPEG-4v2]
equinox.mp4 [H.264]

Another rendering, this time from noon to noon, centered on Stony Brook, NY

Summer Solstice:
sb_summer_solstice_ortho.avi [MS MPEG-4v2]
sb_summer_solstice_ortho.mp4 [H.264]

solstice equinox

Earth Diagram [HD]

An animated diagram pointing out how latitude, zenith, and horizon are defined, as well as showing the orientation of Earth on the Summer Solstice and showing the tropics and (ant)arctic circles.

earth_summer_solstice.avi [MS MPEG-4v2]
earth_summer_solstice.mp4 [H.264]

earth diagram

Seasons [HD]

A simple animation showing how the Earth's axial tilt does not change direction over the course of an orbit, giving rise to the seasons.

Seasons animation:
seasons.avi [MS MPEG-4v2]
seasons.mp4 [H.264]


Resonances in the Asteroid Belt [HD]

A 2:1 resonance between an asteroid (shown in red) and Jupiter (black) as they orbit around the Sun. Some randomly placed asteroids are also shown.

Seasons animation:
asteroids.avi [MS MPEG-4v2]
asteroids.mp4 [H.264]


Tidal locking [HD]

An illustration of tidal locking of a moon in orbit around a planet. The rotation of the moon is visualized by coloring alternate quadrants differently, and watching a stationary person rotate with the moon.. The tidal distortion is always along the planet-moon line.

Tidal locking animation:
tidal_locking.avi [MS MPEG-4v2]
tidal_locking.mp4 [H.264]

tidal locking


Ellipse Geometry Figure

A simple figure used to illustrate the geometry of an ellipse. Here, a is the semi-major axis, e is the eccentricity, and b is the semi-minor axis. r and r' are lines connecting a point on the ellipse (the black dot) to the foci.

Ellipse geometry figure: ellipse_geom.png

ellipse geometry

Eccentricity of Ellipses [HD]

A demonstration of how varying the eccentricity of an ellipse changes the shape.

Ellipse eccentricity animation:
eccentricity.avi [MS MPEG-4v2]
eccentricity.mp4 [H.264]


How to Draw an Ellipse [HD]

A demonstration of how to draw an ellipse. Here we show the distance from each foci to the position on the ellipse, and show that their sum is constant. changes the shape.

Drawing and ellipse animation:
ellipsedraw.avi [MS MPEG-4v2]
ellipsedraw.mp4 [H.264]

drawing an ellipse


Achieving an Orbit [HD]

A simple animation that shows a projectile with increasing horizontal velocity, working up to the circular velocity. (This script uses the image earth.png; image credit: NASA/Apollo 17)

Achieving orbit animation:
achieveorbit.avi [MS MPEG-4v2]
achieveorbit.mp4 [H.264]

achieving orbit

Circular vs. Escape Velocity Animation [HD]

A simple animation showing how the orbit of a projectile around Earth changes as we increase the change the tangential velocity from less than the circular velocity to greater than the escape velocity. (This script uses the image earth.png; image credit: NASA/Apollo 17)

Escape velocity animation:
escape.avi [MS MPEG-4v2]
escape.mp4 [H.264]

escape velocity

Changing An Orbit [HD]

A simple animation showing how an initially circular orbit is changed into an elliptical one by increasing the velocity at perihelion. Two boosts are modeled. (This script uses the image earth.png; image credit: NASA/Apollo 17)

Changing orbit animation:
changing_orbit.avi [MS MPEG-4v2]
changing_orbit.mp4 [H.264]

changing orbit


Blackbody Spectrum (frequency) [HD]

Show how the Planck function varies as temperature is changed. A "thermometer" on the right keeps track of the temperature. Some reference Planck function curves are plotted every 2 orders-of-magnitude in temperature to illustrate the shift in the location of peak intensity with increasing temperature. Also, the visible frequencies are highlighted with a blue shading.

Blackbody spectrum animation:
blackbody.avi [MS MPEG-4v2]
blackbody.mp4 [H.264]


Blackbody Spectrum (wavelength) [HD]

Similar to the animation above, but in terms of wavelenght instead of frequency. Show how the Planck function varies as temperature is changed. A "thermometer" on the right keeps track of the temperature. Some reference Planck function curves are plotted every 2 orders-of-magnitude in temperature to illustrate the shift in the location of peak intensity with increasing temperature. Also, the visible wavelengths are highlighted with a blue shading.

Blackbody spectrum animation:
blackbody_wavelength.avi [MS MPEG-4v2]
blackbody_wavelength.mp4 [H.264]

blackbody wavelength

Random Walk [HD]

A demonstration of a random walk process. A number of small hops are taken in random directions, until the overall displacement is equal to the radius of the circle.

If you change the seed used for the random number generator, you will get a different result.

Random walk animation: random_walk.avi [MS MPEG-4v2]
Random walk animation: random_walk.mp4 [H.264]

random walk

Thermal Motion

A demonstration of the effect of temperature on random thermal motion. Many particles in a gas are shown at two different temperatures.

Note: for simplicity, we do not model collisions between the particles.

Thermal motion animation:

thermal motion


Wave Propagation [HD]

Show two waves of different wavelengths to illustrate the difference between wavelength and frequency. The propagation speed of the two waves is the same. The wavelengths are 1 and 1/4 cm, and the velocity is 2.0 cm/s. A point "fixed" to a vertical line moves up and down as the wave passes by, to illustrate the concept of frequency.

Wave propagation animation:
waves.avi [MS MPEG-4v2]
waves.mp4 [H.264]


Doppler Effect

Show a moving source emitting waves. The wavefronts are plotted as red circles. The source has a speed of 1 m/s and the waves have a propagation speed of 2 m/s. The wave frequency is 3 Hz.

Doppler effect animation:
doppler.avi [MS MPEG-4v2]
doppler.mp4 [H.264]

doppler effect

Doppler Effect 2

Show two moving sources emitting waves. The top source has a speed of 1 m/s and the bottom source has a speed of 0.5 m/s. The waves have a propagation speed of 2 m/s and frequency of 3 Hz. This version shows how the compression of wave fronts depends on the line of sight velocity.

Doppler effect 2 animation:
doppler2.avi [MS MPEG-4v2]
doppler2.mp4 [H.264]

doppler effect 2


Binary Star Orbits [HD]

Animation of a binary pair orbiting their common center of mass (shown as the black "x"). The case of e = 0 and e = 0.4 are shown, with a mass ratio of 1 or 2. These animations show that, in a binary system, the two stars are always opposite one another, with respect to the center of mass, and must have the same period.

binary star animations:

binary stars (mass ratio = 1; e = 0) binary stars (mass ratio = 1; e = 0.4)

binary stars (mass ratio = 2; e = 0.0) binary stars (mass ratio = 2; e = 0.4)

Planetary Orbit and Stellar Motion [HD]

Animation of a small body (planet) orbiting around a larger body (star) showing the small motion of the larger body around the center of mass. This uses a mass ratio of 50 between the two objects.

planetary orbit animations:
planetary_orbits.avi [MS-MPEG-4v2]
planetary_orbits.mp4 [H.264]

planetary orbit

Radial Velocity Planet Detection (circular orbit) [HD]

Illustrate the radial velocity of a star with an unseen planet over the course of a period. Here, the planet's mass was greatly exaggerated to enhance the effect. We also restrict ourselves to being in the plane of the orbits.

radial velocity animation:
radial_velocity.avi [MS MPEG-4v2]
radial_velocity.mp4 [H.264]

radial velocity

Radial Velocity Planet Detection (elliptical orbit) [HD]

Illustrate the radial velocity of a star with an unseen planet over the course of a period. Here, the planet's mass was greatly exaggerated to enhance the effect. We use an elliptical orbit but restrict ourselves to being in the plane of the orbits. The semi-major axis is not perpendicular to the observer.

radial velocity animation:
radial_velocity_ell.avi [MS MPEG-4v2]
radial_velocity_ell.mp4 [H.264]

radial velocity (ellipses)

Eclipsing Binary System

Show an eclipsing binary system and the resulting lightcurve. Here we assume that the smaller star is hotter.

eclipsing binary animation: eclipsing_binary.avi

eclipsing binary

Transiting Planet System

Show a planet transiting across its parent star, and the resulting lightcurve. This is similar to the eclipsing binary system animation above, but now we assume that the smaller object (the planet) is cool.

transiting planet animation:
planetary_transit.avi [MS MPEG-4v2]
planetary_transit.mp4 [H.264]

transiting planet


An animation showing the equipotentials of the gravitational and rotational potential in the co-rotating frame of a binary system. We change the mass parameter, μ = M2/(M1 + M2). In the frames, the less massive star (M2) is on the left.

equipotential animation:
equipotentials.avi [MS MPEG-4v2]
equipotentials.mp4 [H.264]

transiting planet


H-R diagram figure

A simple H-R diagram. The main sequence properties are found from Carroll and Ostlie, Appendix G. Lines of constant radius are drawn in, as well as the location of the white dwarfs.

H-R diagram figure: HR_radius_wd.png

H-R diagram


Radioactive decay figures

A sequence of figures (each represent 1 half life) illustrating the radioactive decay of a sample. Initially 2500 markers are "parents". Each half life, there is a 50% chance a marker decays. After a number of half lifes, no parents remain. A plot showing the exponential decay follows.

radioactive decay animation:
decay.mp4 [H.264]

radioactive decay figures:

radioactive decay 1radioactive decay 1