module Main where

import Animation hiding (planets, translate)
import Picture 

-- Translate a picture by a given vector
translate :: (Float,Float) -> Picture -> Picture
translate v p =
    case p of
      Region c r -> Region c (Translate v r)
      p1 `Over` p2 -> (translate v p1) `Over` (translate v p2)
      EmptyPic -> EmptyPic

-- Translate a picture behavior by a given vector behavior
translateB :: (Behavior Float, Behavior Float) -> Behavior Picture -> Behavior Picture
translateB (x,y) p = lift2 translate (zipB (x,y)) p

-- Convert a pair of behaviors into a pair behavior
zipB :: (Behavior a, Behavior b) -> Behavior (a,b)
zipB (Beh b1, Beh b2) = Beh (\t -> (b1 t, b2 t))

-- Construct a circle behavior
circ :: Behavior Float -> Behavior Shape
circ r = ell r r

-------------------------

sun :: Behavior Picture
sun = reg (lift0 Yellow) (shape (circ 1))

-- Replace the right-hand side of this definition by your solar system(s)
planets :: Behavior Picture
planets = sun

main :: IO()
main = 
  do animateB "Solar system" planets


