home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / progs / demo / X11 / animation / palm.hs < prev    next >
Encoding:
Text File  |  1994-09-27  |  1.1 KB  |  48 lines  |  [TEXT/YHS2]

  1. module Palm (main) where
  2.  
  3. import Animation
  4. import SeaFigs
  5.  
  6. main = getEnv "DISPLAY" >>=
  7.        (\ host -> displaym host 30 trans)
  8.  
  9. trans :: Movie
  10. trans = manright++change++gull2
  11.  
  12. manright::Movie
  13. manright =  mirrorx (take 10 (apply left man))
  14.  
  15. gull2::Movie
  16. gull2 = apply (bPar [right,up,huge,huge,huge,(mov (i (275,0)))])  gull
  17.  
  18. change::Movie
  19. change = inbetween 5  manf1 gull1
  20.               where gull1 = head gull2
  21.                 manf1 = last manright
  22.  
  23.  
  24.  
  25. mirrorx :: Movie -> Movie
  26. mirrorx m = map (flipx_Pic x) m 
  27.               where (x,_)=orig_Movie m
  28.                
  29.  
  30. orig_Movie :: Movie -> Vec
  31. orig_Movie m = ((x2-x1) `div` 2,(y2-y1) `div` 2)
  32.                   where x2 = reduce max (map maxx m)
  33.                         x1 = reduce min (map minx m)
  34.             y2 = reduce max (map maxy m)
  35.             y1 = reduce min (map miny m)
  36.  
  37. maxx :: Pic -> Int
  38. maxx p = reduce max [x | (c,q) <- p, (x,y) <- q]
  39.  
  40. minx :: Pic -> Int
  41. minx p = reduce min [x | (c,q) <- p, (x,y) <- q]
  42.  
  43. maxy :: Pic -> Int
  44. maxy p = reduce max [y | (c,q) <- p, (x,y) <- q]
  45.  
  46. miny :: Pic -> Int
  47. miny p = reduce min [y | (c,q) <- p, (x,y) <- q]
  48.