module Balls where import GraphicsUtils drawBalls :: Window-> Color-> Point-> Point-> IO () drawBalls w c (x1, y1) (x2, y2) = if x1 >= x2 then return () else let el = ellipse (x1, y1) (x2, y2) in do drawInWindow w (withColor c el) drawBalls w (nextColor c) (x1+deltaX, y1) (x2-deltaX, y2) deltaX :: Int deltaX = 25 nextColor :: Color-> Color nextColor Red = Green nextColor Green = Blue nextColor Blue = Red main :: IO () main = runGraphics $ do w <- openWindow "Balls!" (500,500) drawBalls w Blue (25, 25) (485, 485) getKey w closeWindow w