#*********************earth_frames.py*************************
#
# William Baker
#
#  usage:   python earth_frames.py 
#
#*********************************************************

from visual import *
from math import *


def draw():
    sun = sphere(pos=(0,0,0), radius=1, color=color.yellow)
    earthsys=frame()
    earth = sphere(frame=earthsys, pos=(0,0,0), 
            radius=.25, color=color.blue)
    moon = sphere(frame=earthsys, pos=(.5,0,0), radius=.1, 
            color=(.75,.75,.75))
    earthsys.pos=(4.5,0,0)
    
    scene.autoscale=0
    scene.userzoom=1
            
    while 1:
        rate(60)
        #earth.rotate(angle=.001, axis=(0,0,1), origin=sun.pos)
        #moon.pos=(earth.pos[0]+.75,earth.pos[1],earth.pos[2])
        
        #moonval+=.06
        earthsys.rotate(angle=.002, axis=(0,0,1), origin=sun.pos)
        moon.rotate(frame=earthsys, angle=0.05, axis=(0,0,1), origin=(0,0,0))
        
   

def main():

   
    draw()

main()

