Solar eclipse



  • if you are not in chile or argentina for the solar eclipse this code can gif you solace:

    # -------------
    #  settings 
    
    pw = 800
    ph = 500
    
    dia = pw * .45
    frames = 20
    
    # -------------
    #  function(s)
    
    def a_page():
        newPage(pw, ph)
        rect(0, 0, pw, ph)
        radialGradient((pw/2, ph/2), (pw/2, ph/2), [(1, 0.8, 0), (0.9, 0.6, 0) ])
        oval(pw/2-dia/2, ph/2-dia/2, dia, dia)
    
    def ip(a, b, f): return a + (b-a)*f
    
    # -------------
    #  drawings
    
    for frame in range(frames):
        a_page() 
        
        f = frame / frames 
        x = ip(pw/4, pw/4*3, f)
        y = ip(0, ph, f)
        fill(0)
        if abs(x - pw/2) < .2:
            shadow((0, 0), dia/3, (1, 1, 1))
        oval(x - dia/2, y - dia/2, dia, dia)
        
    # saveImage('solar_eclipse.gif')
    

    solar_eclipse.gif


Log in to reply