# Animated Sunset link graphics $define Width 500 # window width $define Height 300 # window height $define Horizon 85 # y-coordinate of horizon $define Radius 50 # size of the sun $define Delay 100 # frame delay in msec $define DX 0.35 # x-coordinate step size $define DY 1.00 # y-coordinate step size procedure main() local i, x, y, w WOpen("width=" || Width, "height=" || Height) | stop("*** cannot open window") # draw "ocean waves" by varying the line width y := Horizon # initial y coordinate w := 1 # initial line width while y - w / 2 < Height do { WAttrib("linewidth=" || w) # set line width DrawLine(0, y, Width, y) # draw line across window y +:= 2 * w + 1 # increment location w +:= w / 3 + 1 # increment line width } # initialize for drawing suns WAttrib("linewidth=4") # set width of perimeter Clip(0, 0, Width, Horizon) # don't draw below horizon x := .3 * Width # initial x position y := Radius + 10 # initial y position # draw animated sun sinking to horizon while y - Radius < Horizon do { Fg("black") DrawCircle(x, y, Radius) # draw sun WDelay(Delay) # delay Fg("white") DrawCircle(x, y, Radius) # erase sun x +:= DX # set next location y +:= DY } WDone() end