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

  1. {-****************************************************************
  2.   MODULE R_DEFAULTS
  3.  
  4.     This module uses the R_Behaviour module to define convient and
  5.   easy to use behaviours. These aren't very sophistated, but they
  6.   can be used to quickly animate a movie. For more sophistated
  7.   animation, a similiar library of sophistocated personnalized 
  8.   functions can be created.
  9.  
  10. ******************************************************************-}
  11.  
  12. module R_Defaults (big, huge, bigger, smaller, ccw, cw, 
  13.                    up, down, left, right,small,tiny)
  14. where
  15.  
  16. import R_Ptypes
  17. import R_Constants
  18. import R_Utility
  19. import R_Picture
  20. import R_Behaviour
  21.  
  22.  
  23.   -- big scales everything up by the scaleunit (now 12/11ths)
  24. big :: Behaviour
  25. big = [scale_Pic x | x <- [scaleunit,scaleunit..]]
  26.  
  27.   -- huge scales everything up by twice the scaleunit (24/11ths)
  28. huge :: Behaviour
  29. huge= [scale_Pic x | x <- [scaleunit*2,(scaleunit*2)..]]
  30.   
  31.   -- small scales everything down by 10/11ths
  32. small :: Behaviour
  33. small = [scale_Pic x | x <- [s,s..]]
  34.         where s = 10
  35.   
  36.   -- tiny scales everything down by 5/11ths
  37. tiny :: Behaviour
  38. tiny  = [scale_Pic x | x <- [s,s..]]
  39.         where s = 5
  40.   
  41.   -- bigger causes the Pics to be scaled up by 12/11ths,24/11ths,36/11ths
  42.   -- and so on, everincreasing.
  43. bigger :: Behaviour
  44. bigger = [scale_Pic x | x <- (rept (\x -> div (x*scaleunit) 11) 1)]
  45.   
  46.   -- smaller causes the Pics to be scaled downwards in ever decreasing 
  47.   -- amounts.
  48. smaller :: Behaviour
  49. smaller = [scale_Pic x | x <- (rept (\x -> div (x*10) 11) 1)]
  50.   
  51.   -- a hardwired version of ccw that rotates the Pics by one rotunit
  52.   -- more every Pic, counterclockwise.
  53. ccw :: Behaviour
  54. ccw = [twist_Pic x | x <- [0.0,rotunit..]]
  55.   
  56.   -- same as ccw, but rotates the Pics clockwise
  57. cw :: Behaviour
  58. cw = [twist_Pic x | x <- [0.0,-rotunit..]]
  59.   
  60.   -- moves the Pic up by one more unit every Pic.
  61. up :: Behaviour
  62. up    = [mov_Pic (x,y) | (x,y)<- zip2 [0,0..] [0,unit..]]
  63.  
  64.   -- moves the Pic down by one more unit every Pic.  
  65. down :: Behaviour
  66. down  = [mov_Pic (x,y) | (x,y)<-zip2 [0,0..] [0,-unit]] 
  67.   
  68.   -- moves the Pic left by one more unit every Pic.
  69. left :: Behaviour
  70. left  = [mov_Pic (x,y) | (x,y)<- zip2 [0,-unit..] [0,0..]] 
  71.   
  72.   -- moves the Pic right by one more unit every Pic.
  73. right :: Behaviour
  74. right = [mov_Pic (x,y) | (x,y)<- zip2 [0,unit..] [0,0..]] 
  75.   
  76.  
  77.