packages feed

mcmaster-gloss-examples (empty) → 2013

raw patch · 9 files changed

+693/−0 lines, 9 filesdep +basedep +gloss

Dependencies added: base, gloss

Files

+ HauntedHouse.hs view
@@ -0,0 +1,148 @@+module Main where
+
+--(c)  Mackenzie Campbell, Manaar Hyder and Maya Ramamurthy.  Permission is granted to distributed and modify this example, as long as this copyright statement is included
+
+import Graphics.Gloss
+import Graphics.Gloss.Data.Color
+
+
+grey = greyN 0.4
+grey1 = greyN 0.7
+grey2 = greyN 0.8
+grey3 = greyN 0.6
+main = draw $
+    (Pictures[      
+        (color green(Polygon [(-410,-400),(-410,0),(410,0),(410,-400)])), -- grass
+        Translate (-325) 300 (color yellow (ThickCircle 20 50)), -- moon
+        Translate (-300) 325 (color black (ThickCircle 20 50)), -- moon shadow 
+        (color yellow(Polygon[(-140,325),(-125,350),(-110,325)])), -- star 1 - 6pt
+        (color yellow(Polygon[(-140,340),(-125,315),(-110,340)])), -- star 1 - 6pt
+        (color yellow(Polygon[(340,125),(325,150),(310,125)])), -- star 2 - 6pt
+        (color yellow(Polygon[(340,140),(325,115),(310,140)])), -- star 2 - 6pt
+        (color cyan (Polygon [(-280,175),(-295,175),(-340,125),(-315,125)])), -- lightening bolt - 1st half 
+        (color cyan (Polygon [(-340,125),(-315,125),(-250,95),(-265,95)])), -- lightening bolt - 2nd half 
+        (color cyan (Polygon [(-250,95),(-265,95),(-350,10),(-350,10)])), -- lightening bolt - 3rd half 
+        (color yellow(Polygon [(-355,-10),(-355,10),(-345,10),(-345,-10)])), -- pumpkin stem
+        Translate (-300) 215 (color grey1 (ThickCircle 30 50)), -- cloud fluff 1
+        Translate (-350) 215 (color grey1 (ThickCircle 12 40)), -- cloud fluff 2 -- left 
+        Translate (-300) 200 (color grey1 (ThickCircle 15 40)), -- cloud fluff 3 -- donut hole filling 
+        Translate (-250) 215 (color grey1 (ThickCircle 12 40)), -- cloud fluff 4 -- right
+        Translate (300) 325 (color grey1 (ThickCircle 10 50)), -- skull head 
+        (color black(Polygon [(273,282),(327,282),(327,302),(273,302)])), -- skull head cut off
+        (color grey1(Polygon [(275,287),(325,287),(325,302),(275,302)])), -- skull teeth 
+        Translate (283) 325 (color black (ThickCircle 3 20)), -- skull eye
+        Translate (317) 325 (color black (ThickCircle 3 20)), -- skull eye 
+        Translate (305) 300 (color black (ThickCircle 1 5)), -- skull nostril 
+        Translate (295) 300 (color black (ThickCircle 1 5)), -- skull nostril
+        (color grey1(Polygon [(275,270),(325,270),(325,280),(275,280)])), -- skull lower jaw
+        Translate (200) 325 (color grey1 (ThickCircle 10 50)), -- smoke plume
+        Translate (122) 315 (color grey1 (ThickCircle 10 40)), -- smoke plume 
+        Translate (162) 335 (color grey1 (ThickCircle 10 20)), -- smoke plume 
+        Translate (160) 305 (color grey1 (ThickCircle 5 20)), -- smoke plume 
+        Translate (233) 300 (color grey1 (ThickCircle 5 20)), -- smoke plume 
+        Translate (240) 335 (color grey1 (ThickCircle 5 20)), -- smoke plume 
+        Translate (-240) 350 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (-210) 300 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (-270) 50 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (-370) 100 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (90) 350 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (240) 250 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (360) 350 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (360) 200 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (240) 50 (color yellow (ThickCircle 2 5)), -- simple star
+        Translate (-240) 150 (color yellow (ThickCircle 2 5)), -- simple star
+        (color red (Polygon [(200,200),(200,-200),(-200,-200),(-200,200)])), -- base of house
+        (color grey(Polygon[(-200,200),(0,350),(200,200)])), -- roof of house
+        Translate 0 270(color black (ThickCircle 8 50)),--attic circle
+        (color black (Polygon [(-33,210),(-33,270),(33,270),(33,210)])),--attic square
+        Translate 0 270(color yellow (ThickCircle 8 46)),--attic circle lit
+        (color yellow (Polygon [(-31,212),(-31,268),(31,268),(31,212)])),--attic square lit
+        (color grey (Polygon [(100,200),(100,290),(150,290),(150,200)])),--chimney
+        (color magenta (Polygon [(50,50),(50,150),(150,150),(150,50)])),--window
+        (color magenta (Polygon [(-50,50),(-50,150),(-150,150),(-150,50)])),--window
+        (color black (Polygon [(-70,-180),(-70,30),(70,30),(70,-180)])),--door
+        Translate 50 (-100) (color cyan (ThickCircle 0.5 20)),--doorknob
+        (color violet (Polygon [(-40,-70),(-40,10),(40,10),(40,-70)])),--door window
+        (color black (Polygon [(50,50),(50,98),(98,98),(98,50)])),--bottom left square
+        (color black (Polygon [(102,50),(102,98),(150,98),(150,50)])),--bottom right  square
+        (color black (Polygon [(102,102),(102,150),(150,150),(150,102)])),--top right square 
+        (color black (Polygon [(50,102),(50,150),(98,150),(98,102)])),--top left square
+        (color black (Polygon [(-50,50),(-50,98),(-98,98),(-98,50)])),--bottom left square
+        (color black (Polygon [(-102,50),(-102,98),(-150,98),(-150,50)])),--bottom right  square
+        (color black (Polygon [(-102,102),(-102,150),(-150,150),(-150,102)])),--top right square 
+        (color black (Polygon [(-50,102),(-50,150),(-98,150),(-98,102)])),--top left square
+        (color orange (Polygon [(-2,212),(3,212),(3,301),(-2,301)])),--vertical line attic
+        (color orange (Polygon [(-31,248),(31,248),(31,252),(-31,252)])),--horizontal line attic 
+        (color violet (Polygon [(50,50),(50,54),(150,54),(150,50)])),--window pane bottom
+        (color violet (Polygon [(50,50),(50,150),(54,150),(54,50)])),--window pane left
+        (color violet (Polygon [(146,50),(146,150),(150,150),(150,50)])),--window pane right
+        (color violet (Polygon [(50,146),(50,150),(150,150),(150,146)])),--window pane top
+        (color violet (Polygon [(-50,50),(-50,54),(-150,54),(-150,50)])),--window pane bottom
+        (color violet (Polygon [(-50,50),(-50,150),(-54,150),(-54,50)])),--window pane left
+        (color violet (Polygon [(-146,50),(-146,150),(-150,150),(-150,50)])),--window pane right
+        (color violet (Polygon [(-50,146),(-50,150),(-150,150),(-150,146)])),--window pane top
+        (color grey(Polygon [(-75,-400),(-50,-200),(50,-200),(75,-400)])), -- path
+        (color grey2 (Polygon [(-70,-200),(-70,-180),(70,-180),(70,-200)])),--topest step
+        (color grey3 (Polygon [(-90,-220),(-90,-200),(90,-200),(90,-220)])),--other step
+        (color azure (Polygon [(-40,-70),(-40,-30),(-40,-30),(-10,-70)])),--bottom left curtain
+        (color azure (Polygon [(-40,-30),(-40,10),(-10,10),(-40,10)])),--top left curtain
+        (color azure (Polygon [(10,10),(40,10),(40,-30),(10,10)])),--top right curtain
+        (color azure (Polygon [(10,-70),(40,-70),(40,-30),(10,-70)])),--bottom right curtain
+        (color yellow(Polygon [(-355,-10),(-355,10),(-345,10),(-345,-10)])), -- pumpkin stem
+        Translate (-350) (-50) (color orange (ThickCircle 20 50)), -- pumpkin
+        Translate (-350) (-50) (color black (Circle 45)), -- pumpkin
+        Translate (-350) (-50) (color black (ThickCircle 10 40)), -- pumpkin mouth 1 orange
+        Translate (-350) (-50) (color yellow (ThickCircle 10 35)), -- pumpkin mouth 1 yellow
+        Translate (-350) (-48) (color black (ThickCircle 10 35)), -- pumpkin mouth 1 black
+        Translate (-350) (-43) (color orange (ThickCircle 10 40)), -- pumpkin mouth 2 orange
+        (color black (Polygon [(-340,-40),(-330,-25),(-320,-40)])), -- pumpkin eye right
+        (color yellow (Polygon [(-336,-38),(-330,-27),(-324,-38)])), -- pumpkin eye right yellow
+        (color black (Polygon [(-380,-40),(-370,-25),(-360,-40)])), -- pumpkin eye left
+        (color yellow (Polygon [(-376,-38),(-370,-27),(-364,-38)])), -- pumpkin eye left yellow
+        (color black (Polygon [(-355,-50),(-350,-60),(-345,-50)])), -- pumpkin nose
+        (color yellow (Polygon [(-353,-51),(-350,-57),(-347,-51)])), -- pumpkin nose yellow
+        (color grey(Polygon [(-400,-250),(-400,-175),(-325,-175),(-325,-250)])), -- gravestone1
+        Translate (-363) (-185) (color grey (ThickCircle 16 45)), -- gravestone1
+        (color grey(Polygon [(-250,-250),(-250,-175),(-175,-175),(-175,-250)])), -- gravestone2
+        Translate (-213) (-185) (color grey (ThickCircle 16 45)), -- gravestone2
+        (color grey(Polygon [(-330,-150),(-330,-75),(-255,-75),(-255,-150)])), -- gravestone3
+        Translate (-293) (-85) (color grey (ThickCircle 16 45)), -- gravestone3
+        (color grey(Polygon [(400,-250),(400,-175),(325,-175),(325,-250)])), -- gravestone4
+        Translate (363) (-185) (color grey (ThickCircle 16 45)), -- gravestone4
+        (color grey(Polygon [(250,-250),(250,-175),(175,-175),(175,-250)])), -- gravestone5
+        Translate (213) (-185) (color grey (ThickCircle 16 45)), -- gravestone5
+        (color grey(Polygon [(330,-150),(330,-75),(255,-75),(255,-150)])), -- gravestone6
+        Translate (293) (-85) (color grey (ThickCircle 16 45)), -- gravestone6      
+         Translate (-320) (-100) $ Scale 0.3 0.3 $ Text "RIP", -- RIP 1
+         Translate (-390) (-200) $ Scale 0.3 0.3 $ Text "RIP", -- RIP 2
+         Translate (-240) (-200) $ Scale 0.3 0.3 $ Text "RIP", -- RIP 3
+         Translate (260) (-100) $ Scale 0.3 0.3 $ Text "RIP", -- RIP 4
+         Translate (340) (-200) $ Scale 0.3 0.3 $ Text "RIP", -- RIP 5
+         Translate (190) (-200) $ Scale 0.3 0.3 $ Text "RIP", -- RIP 6
+        (color black(Polygon[(-400,-400),(-400,-150),(-393,-125), (-385,-150), (-385,-400)])),--fence 1
+        (color black(Polygon[(-350,-400),(-350,-150),(-343,-125), (-335,-150), (-335,-400)])),--fence 2
+        (color black(Polygon[(-300,-400),(-300,-150),(-293,-125), (-285,-150), (-285,-400)])),--fence 3
+        (color black(Polygon[(-250,-400),(-250,-150),(-243,-125), (-235,-150), (-235,-400)])),--fence 4
+        (color black(Polygon[(-200,-400),(-200,-150),(-193,-125), (-185,-150), (-185,-400)])),--fence 5
+        (color black(Polygon[(-150,-400),(-150,-150),(-143,-125), (-135,-150), (-135,-400)])),--fence 6
+        (color black(Polygon[(-100,-400),(-100,-150),(-93,-125), (-85,-150), (-85,-400)])),--fence 7
+        (color black(Polygon[(100,-400),(100,-150),(108,-125), (115,-150), (115,-400)])),--fence 8
+        (color black(Polygon[(150,-400),(150,-150),(158,-125), (165,-150), (165,-400)])),--fence 9
+        (color black(Polygon[(200,-400),(200,-150),(208,-125), (215,-150), (215,-400)])),--fence 10
+        (color black(Polygon[(250,-400),(250,-150),(258,-125), (265,-150), (265,-400)])),--fence 11
+        (color black(Polygon[(300,-400),(300,-150),(308,-125), (315,-150), (315,-400)])),--fence 12
+        (color black(Polygon[(350,-400),(350,-150),(358,-125), (365,-150), (365,-400)])),--fence 13
+        (color black(Polygon[(400,-400),(400,-150),(408,-125), (415,-150), (415,-400)])),--fence 14     
+        (color black(Polygon [(-400,-330),(-400,-315),(-100,-315),(-100,-330)])), -- fence 15
+        (color black(Polygon [(100,-330),(100,-315),(400,-315),(400,-330)])), -- fence 16
+        (color black(Polygon [(-400,-230),(-400,-215),(-100,-215),(-100,-230)])), -- fence 17
+        (color black(Polygon [(100,-230),(100,-215),(400,-215),(400,-230)])), -- fence 18
+        (color black(Polygon [(-261,-155),(-257,-135),(-253,-155)])), -- grass spike 1- outline
+        (color green(Polygon [(-259,-155),(-257,-136),(-255,-155)])), -- grass spike 1 
+        (color black(Polygon [(-253,-155),(-250,-135),(-247,-155)])), -- grass spike 2 - outline
+        (color green(Polygon [(-251,-155),(-250,-136),(-249,-155)])) -- grass spike 2
+        ]
+    )
+--colours: azure, bright, chartreuse, cyan, dark, dim, green, greyN, rose, light, magenta, orange, blue, black, red, green, yellow
+draw = display
+    (InWindow "Haunted House" (810,750)(10,10)) black
+ MovingStar.hs view
@@ -0,0 +1,64 @@+---------++--(c) 2013 Ahmed Khan, MATTHEW PRIOR-COXHEAD    +--Permission granted to distributed and modify, as long as this notice is preserved. Distributed without warrantee++---------++module Main where++import Graphics.Gloss++--define the main function+main :: IO ()+--creates a window with the name create moving star, which is 650 by 450 pixels big and positions 0 by 0 on the screen, which is on the top left+main + =  animate (InWindow "create moving star" (650, 450) (0, 0))+                (greyN 0.1)+        frame++--the frame function takes a float and returns a the picture which is displayed at that given time+-- the float represents the amount of time that has passed since thes start of the animation +--the frame function calls the function getFracs for each individual rectangle on the screan+--the getFracs returns a list of objects, which are all the particles+frame :: Float -> Picture+frame timeS+ = Pictures (getFracs timeS)+ + + -- these varibles effect the circular  pattern behavior +bigR :: Float+bigR = 80.0+r :: Float+r = 20.0+p :: Float+p = 158.0++--this function takes an int and returns a color+differentColors :: Int -> Color+differentColors 0 = makeColor 0.0 1.0 0.0 0.9+differentColors 1 = makeColor 0.0 0.0 1.0 0.9+differentColors 2 = makeColor 1.0 0.0 0.0 0.9++-- draws the rectangle, and calls the differentColors function for the color+-- the int for the color is determined by dividing the time by three and returning its remainder into the function. +-- makes makes it so each object changes color ofter 3 seconds+drawRectangle timeS = Color (differentColors (mod (round (timeS*0.98)) 3)) $ rectangleUpperSolid 5 10+ +--this function calls itself until the time variable is lower then 0+--this function draws each individual particle using the spiroFrac function+getFracs timeS = if timeS > 0 then [spiroFrac 1 timeS] ++ getFracs (timeS-0.2) else [] -- gets a series of rectanlges+++--This function makes the fractal+spiroFrac :: Int -> Float -> Picture+spiroFrac n timeS -- this actually generates the fractal+ =  let x = ((r+bigR)*cos(timeS + 3*pi/2)) + (r*cos(((timeS)*bigR)/(r) + 3*pi/2));+        y = ((r+bigR)*(sin(timeS + pi/2))) + (r*sin(((timeS)*bigR)/(r) - pi/4));+        rotatedImage = Rotate (-atan(y/x)*180/pi) (drawRectangle timeS)+        in Pictures [Translate x y (rotatedImage)] +--so the spiroFrac actually detirmines the position and rotation of all the particles. +--The basis of all this equation is to create a circle with the radius of the inner area of the star. +--then create another circle on top of that circle rolling around it. This is known as a spiro+--but what this does is create a line straight through the circle as time passes as the circle is rolling around the big circle+ 
+ Parabolic.hs view
@@ -0,0 +1,91 @@+module Main where
+import Graphics.Gloss
+
+{-
+
+(c) 2013 Zichen Jiang, Yi Wang
+Permission granted to distribute and modify, as long as this notice is preserved. Distributed without warrantee.
+
+The program creates sets of lines and rotates two sets of them.
+
+For the lines on the sides, here is an example on the left bottom set of the lines. 
+The program first draw a line from the point with coordinates (0,MaxY) to the point 
+with coordinates (0 + interval, 0), then draw the second line from (0, MaxY - interval) 
+to (0 + 2*interval, 0), and then draw the third line from (0, MaxY - 2*interval) to 
+(0 + 3*interval, 0), and so forth.
+
+The sets of lines located at the center shares the same principle with the sets on 
+the sides, but with opposite x and y value.
+
+-}
+winX=600
+winY=600
+winHalfX=300--div winX 2
+winHalfY=300--div winY 2
+
+
+main = animateIt
+
+animateIt = animate
+    (InWindow "Gloss Project - Parabolic lines - A&J Production" (600,600) (10,10))
+    black
+    frame
+        
+drawCent = display
+    (InWindow "Gloss Project - Parabolic lines - A&J Production" (600,600) (10,10))
+        white
+    $ Pictures $ (calcParaCent 50)
+
+drawSide = display
+    (InWindow "Parabolic lines" (600,600) (10,10))
+    white
+    $ Pictures $ calcParaSide 50
+        
+frame :: Float -> Picture
+frame time = Pictures $(
+            {-[color white (Rotate (time/3600 * pi) $ Pictures $ calcParaCent 24)] ++  --hour arm
+            [color white (Rotate (time/60 * pi) $ Pictures $ calcParaCent 30)] ++  --minute arm
+            [color white (Rotate (time/1 * pi) $ Pictures $ calcParaCent 48)] ++  --second arm-}
+            [color white (Rotate (time * 4 * pi) $ Pictures $ calcParaCent 50)] ++
+            [color white (Rotate (time * 6 * pi) $ Pictures $ calcParaCent 30)] ++
+            [color white ( Pictures $ calcParaSide 50)])
+            
+            
+calcParaSide m = parabolicSide m m 
+calcParaCent m = parabolicCenter m m 
+
+--drawParabolic m = Pictures calcParabolic m
+
+--Parabolics from the sides
+parabolicSide n m
+    | n == (-1) = []
+    | n > (-1) = 
+            --quadrant 3 starting pointing is at top left corner, draw lines to the bottom side from left to right
+            [line [(-winHalfX, winHalfY-n*stepy),(-winHalfX+stepx*n, -winHalfY)]] ++
+            --quadrant 2 starting point is at bottom right corner, draw lines to the top side from right to left
+            [line [(winHalfX, (-winHalfY)+n*stepy),(winHalfX-stepx*n, winHalfY)]] ++
+            --quadrant 1 starting point is at bottom left corner, draw lines to the top side from left to right
+            [line [(-winHalfX, (-winHalfY)+n*stepy),((-winHalfX)+stepx*n, winHalfY)]] ++
+            --quadrant 4 starting point is at top right corner, draw lines to the bottom side from right to left
+            [line [(winHalfX, winHalfY-n*stepy),(winHalfX-stepx*n, -winHalfY)]] ++
+            (parabolicSide (n-1) m)
+                where 
+                    stepx=winX / m
+                    stepy=winY / m
+
+--Parabolics from the center
+parabolicCenter n m
+    | n == (m/2-1) = []
+    | (n >= (m/2)) = 
+            --quadrant 3 starting pointing is at most negative x axis, draw lines to the negative y axis from top to bottom
+            [line [(n*stepx - 2*winHalfX,0),(0, winHalfY - stepy*n)]] ++
+            --quadrant 2 starting point is at bottom right corner, draw lines to the top side from right to left
+            [line [(n*stepx - 2*winHalfX,0),(0, stepy*n - winHalfY)]] ++
+            --quadrant 1 starting point is at bottom left corner, draw lines to the top side from left to right
+            [line [(2*winHalfX - n*stepx,0),(0, stepy*n - winHalfY)]] ++
+            --quadrant 4 starting point is at top right corner, draw lines to the bottom side from right to left
+            [line [(2*winHalfX - n*stepx,0),(0, winHalfY - stepy*n)]] ++
+            (parabolicCenter (n-1) m)
+                where 
+                    stepx=winX / m
+                    stepy=winY / m
+ SolarSystem.hs view
@@ -0,0 +1,134 @@+{- 
+(c) 2013  Trevor Rae, Paul Warnick, James Zhu, Katrine Rachitsky
+Permission granted to distributed and modify, as long as this notice is preserved. Distributed without warranty.
+-}
+
+module Main where 
+import Graphics.Gloss
+
+----------------------------------------------------------------------------------------------------
+
+sun :: Color -- Colours the Sun
+sun = makeColor 1.0 0.7 0.0 0.7
+
+mercury :: Color -- Colours each planet properly
+mercury = makeColor 1.0 1.0 1.0 0.7
+
+venus :: Color
+venus = makeColor 1.0 0.5 0.2 0.7
+
+earth :: Color
+earth = makeColor 0.1 0.9 0.4 0.7
+
+mars :: Color
+mars = makeColor 1.0 0.1 0.1 0.7
+
+jupiter :: Color
+jupiter = makeColor 0.7 0.5 0.2 0.7
+
+saturn :: Color
+saturn = makeColor 0.7 0.4 0.1 0.7
+
+uranus :: Color
+uranus = makeColor 0.0 0.9 0.8 0.7
+
+neptune :: Color
+neptune = makeColor 0.1 0.1 0.9 0.7
+
+pluto :: Color
+pluto = makeColor 1.0 1.0 1.0 0.7
+
+----------------------------------------------------------------------------------------------------
+
+main = solar
+
+solar = draw $ \t -> Pictures $ -- when "solar" is typed into ghci the picture is drawn using the "animate" function
+    [
+        Translate (-423) 373 $ Color white $ ThickCircle 0 2, -- all of this is just the stars for effect
+        Translate (-245) 456 $ Color white $ ThickCircle 0 2,
+        Translate (-503) 283 $ Color white $ ThickCircle 0 2,
+        Translate (-234) 443 $ Color white $ ThickCircle 0 2,
+        Translate (-150) 253 $ Color white $ ThickCircle 0 2,
+        Translate (-320) 412 $ Color white $ ThickCircle 0 2,
+        Translate (-650) 125 $ Color white $ ThickCircle 0 2,
+        Translate (-450) 342 $ Color white $ ThickCircle 0 2,
+        Translate (-350) 212 $ Color white $ ThickCircle 0 2,
+        Translate 220 (-342) $ Color white $ ThickCircle 0 2,
+        Translate 284 (-423) $ Color white $ ThickCircle 0 2,
+        Translate 385 (-231) $ Color white $ ThickCircle 0 2,
+        Translate 544 (-230) $ Color white $ ThickCircle 0 2,
+        Translate 364 (-420) $ Color white $ ThickCircle 0 2,
+        Translate 634 (-234) $ Color white $ ThickCircle 0 2,
+        Translate 273 (-435) $ Color white $ ThickCircle 0 2,
+        Translate 253 (-342) $ Color white $ ThickCircle 0 2,
+        Translate 345 (-213) $ Color white $ ThickCircle 0 2,
+        Translate 745 (-123) $ Color white $ ThickCircle 0 2,
+        Translate (-823) (-423) $ Color white $ ThickCircle 0 2,
+        Translate (-820) (-232) $ Color white $ ThickCircle 0 2,
+        Translate (-923) (-343) $ Color white $ ThickCircle 0 2,
+        Translate (-723) (-234) $ Color white $ ThickCircle 0 2,
+        Translate (-753) (-123) $ Color white $ ThickCircle 0 2,
+        Translate (-173) (-123) $ Color white $ ThickCircle 0 2,
+        Translate (-586) (-432) $ Color white $ ThickCircle 0 2,
+        Translate (-834) (-321) $ Color white $ ThickCircle 0 2,
+        Translate (-283) (-234) $ Color white $ ThickCircle 0 2,
+        Translate (-345) (-234) $ Color white $ ThickCircle 0 2,
+        Translate (-384) (-434) $ Color white $ ThickCircle 0 2,
+        Translate (-856) (-321) $ Color white $ ThickCircle 0 2,
+        Translate (-384) (-423) $ Color white $ ThickCircle 0 2,
+        Translate 856 232 $ Color white $ ThickCircle 0 2,
+        Translate 834 324 $ Color white $ ThickCircle 0 2,
+        Translate 934 342 $ Color white $ ThickCircle 0 2,
+        Translate 263 432 $ Color white $ ThickCircle 0 2,
+        Translate 342 324 $ Color white $ ThickCircle 0 2,
+        Translate 564 234 $ Color white $ ThickCircle 0 2,
+        Translate 435 231 $ Color white $ ThickCircle 0 2,
+        Translate 765 234 $ Color white $ ThickCircle 0 2,
+        Translate 123 234 $ Color white $ ThickCircle 0 2,
+        
+----------------------------------------------------------------------------------------------------
+        
+        planet 100 5 (t) sun, -- here each planet is put in the picture with the names, it uses the planet radius, orbit from the centre, t measures the speed of orbit and the last part is the colour
+        names 5 (t) white "Sun", -- this does the same as above but with the name 
+        planet 10 75  (t*1.6) mercury ,
+        names 75 (t*1.6) white "Mercury",
+        planet 25 100 (-t*1.18) venus,
+        names 100 (-t*1.18) white "Venus",
+        planet 17 115 (t) earth,
+        names 115 (t) white "Earth",
+        planet 13 130 (t*0.8) mars,
+        names 130 (t*0.8) white "Mars",
+        planet 100 250(t*0.4) jupiter,
+        names 250 (t*0.4) white "Jupiter",
+        planet 80 350 (t*0.3) saturn,
+        names 350 (t*0.3) white "Saturn",
+        planet 65 450 (-t*0.2) uranus,
+        names 450 (-t*0.2) white "Uranus",
+        planet 70 520 (t*0.18) neptune,
+        names 520 (t*0.18) white "Neptune",
+        planet 10 600 (t*0.15) pluto,
+        names 600 (t*0.15) white "Pluto"
+    ] 
+            
+----------------------------------------------------------------------------------------------------
+
+planet planetRadius orbitalRadius theta col =  -- determines what happens when "planet" is used
+    Pictures 
+    [
+        Color white $ Circle orbitalRadius, Translate (orbitalRadius * sin theta) (orbitalRadius * cos theta) $ Color col $ ThickCircle 0 planetRadius -- colours a circle white, and translates a thick circle around it 
+    ]
+    
+----------------------------------------------------------------------------------------------------
+    
+names orbitalRadius theta col name = -- same as above but with the names, also rotates the names around the planets
+    Pictures
+    [
+        Translate (orbitalRadius * sin theta) (orbitalRadius * cos theta) $ Scale 0.1 0.1 $ Rotate (orbitalRadius * sin theta) $ Color white $ Text (show name) 
+    ]
+            
+----------------------------------------------------------------------------------------------------
+            
+draw = animate -- opens the program in a seperate window named "Solar System"
+        (InWindow
+                "Solar System" (1900, 1000) (0,0))
+            black
+ Stare.hs view
@@ -0,0 +1,61 @@+-- (c) 2013 Mingfei Jiang
+-- Permission granted to distributed and modify, as long as this notice is preserved.  Distributed without warrantee. 
+
+module Main where
+import Graphics.Gloss
+
+main = animate (InWindow "Gloss" (700,700) (0,0))
+           black picture
+
+picture :: Float -> Picture
+picture 0 = text "Value cannot be 0"
+picture number = scale 6.5 6.5 (color rose $ drawpicture number)
+
+orangered, orangered2, orangered3 :: Color -- define custom colours
+orangered = makeColor 1.0 0.251 0.0 0.7
+orangered2 = makeColor 1.0 0.251 0.0 0.5
+orangered3 = makeColor 1.0 0.251 0.0 0.3
+
+intervalsmall = [0,11.25,22.5,33.75,45,56.25,67.5,78.75] -- define intervals of rotation
+intervalbig = [0,22.5,45,67.5,90,112.5,135,157.5,180,202.5,225,247.5,270,292.5,315,337.5]
+xlist = [2,4..50] -- define the coordinates used to draw the outside grid
+ylist = [0,2..48]
+
+squares = pictures[rotate x (line [(-50,0),(0,50),(50,0),(0,-50),(-50,0)]) | x <- intervalsmall] --draws a square in the centre and rotate them every 11.25 degrees.
+stars = pictures[rotate x ((pictures [line [(-8.5,0),(0,50),(8.5,0)],line[(0,50),(0,0)]])) | x <- intervalbig] --draws one side of the star and rotate every 22.5 degrees
+grid = pictures[line [(0,y),(x,50)] | x <- xlist, y <- ylist, x-y==2] --draws one corner of the grid on the inside
+insidegrid = pictures[
+    translate 0 (-50) grid,
+    rotate 90 (translate 0 (-50) grid),
+    rotate 180 (translate 0 (-50) grid),
+    rotate 270 (translate 0 (-50) grid)] --puts together the 4 sides to make a star
+
+rotVal :: Float -> Float --rotate speeds (clockwise and counter clockwise)
+rotVal x = x - (x / (0.01*pi))
+
+rotVal1 :: Float -> Float
+rotVal1 x = x - (x / (-0.01*pi))
+
+drawpicture :: Float -> Picture
+drawpicture number = pictures [
+    rot $ color red (pictures [circle 50,circle 8.5]), -- draws the outside circle
+    rot1 $ line [(-50,-50),(-50,50),(50,50),(50,-50),(-50,-50)], -- draws the outside box
+    rot $ squares, -- draws inside squares circumscribed in each other
+    rot1 $ scale 0.7 0.7 squares,
+    rot1 $ scale 0.49 0.49 squares,
+    rot1 $ scale 0.347 0.347 squares,
+    rot1 $ scale 0.242 0.242 squares,
+    rot $ color orange stars, --draws the stars, and 2 more smaller ones in the centre
+    rot (color orange (scale 0.178 0.178 stars)),
+    rot (rotate 11.25 (scale 0.178 0.178 stars)),
+    rot1 $ translate (-50) 0 grid, --draws the outside grid using the inside grid corner
+    rot1 $ rotate 90 (Translate (-50) 0 grid),
+    rot1 $ rotate 180 (Translate (-50) 0 grid),
+    rot1 $ rotate 270 (Translate (-50) 0 grid),
+    rot $ color orangered insidegrid, --draws the inside grid and rotate it ever 22.5 degress
+    rot $ color orangered2 (rotate 45 insidegrid),
+    rot $ color orangered3 (rotate 22.5 insidegrid),
+    rot $ color orangered3 (rotate 67.5 insidegrid)
+    ]
+  where rot = rotate (rotVal number)
+        rot1 = rotate (rotVal1 number)
+ Waves.hs view
@@ -0,0 +1,83 @@+module Main where
+
+{----------------------------------------------------------------------
+(c) 2013 Sergio Cosman Agraz
+Permission granted to distributed and modify.   Distributed without warrantee.
+
+Instructions
+
+Create ocean waves (animation)
+
+Type on GHCi:               main
+to execute the waves.
+-----------------------------------------------------------------------}
+
+import Graphics.Gloss
+
+-- Begin Color Palette
+
+wave :: Color
+wave = makeColor 0.3 0.3 1.0 1.0
+
+waveEdge :: Color
+waveEdge = makeColor 0.0 0.0 1.0 0.5
+
+sky :: Color
+sky = makeColor 0.1 0.1 0.2 1.0
+
+moon :: Color 
+moon = makeColor 0.8 0.9 0.5 1.0
+
+crater :: Color
+crater = makeColor 0.5 0.7 0.3 1.0
+
+-- End Color Palette
+
+main :: IO ()
+main = animate (InWindow "Wave" (700,600) (10,100)) (sky) frame
+ 
+-- Produce one frame of the animation
+
+frame :: Float -> Picture
+frame timeS
+ = Pictures
+        -- the moon
+        [ Translate (-150)  150     luna
+        --wave
+        , Translate 0 (-150) $ waveMotion 5 timeS 
+        ]
+        
+-- The moon craters, outline, and the water (in respect to the moon`s position).
+luna :: Picture
+luna
+ = Pictures 
+            --Moon
+            [ Color moon                $ thickCircle 50 100
+            , Color white               $ circle 100    
+            , Translate 0 0             $ Color crater      $ thickCircle 10 20
+            , Translate (-10) (-35)     $ Color crater      $ ThickCircle 5 15  
+            , Translate 50 (-45)        $ Color crater      $ thickCircle 10 30
+            , Translate (-5) 65         $ Color crater      $ thickCircle 10 30
+            , Translate (60) 25         $ Color crater      $ thickCircle 10 30
+            , Translate (-60) 0         $ Color crater      $ thickCircle 10 30
+            -- Water
+            , Translate 50 (-550)       $ Color wave        $ rectangleSolid 1000 500
+            ]
+            
+-- The wave motion:
+
+waveMotion :: Int -> Float -> Picture
+waveMotion 0 timeS = Blank
+waveMotion n timeS
+ = Pictures
+        [ Color wave            $ thickCircle 20 210
+        , Color waveEdge        $ thickCircle 0  210
+        
+        , Translate 200 (-30)   $ Rotate (150 * sin timeS / (fromIntegral n) )
+                                $ Scale 0.9 0.9
+                                $ waveMotion (n-1) timeS
+        
+        , Translate (-200) (-30)    $ Rotate  (-20 * cos timeS / (fromIntegral n))
+                                    $ Scale   0.8 0.8
+                                    $ waveMotion (n-1) timeS        
+        ]
+ Windmills.hs view
@@ -0,0 +1,41 @@+-- © 2013 Yash Patel, Chinthujan Nandakumar 
+-- Permission granted to distribute, use or modify this code, as long as this notice is preserved.
+
+module Main where
+
+import Graphics.Gloss
+
+main    = animate (InWindow "Assignment" (800, 600) (10, 10))
+                  (greyN 0.2) frame
+
+frame time = Scale 0.8 0.8
+           $ animation time 6 -- # of rectangles = # + 1
+    
+    
+animation t 0  = part0 -- if t 0 then 1 rectangle (main rectangle)
+animation t d        -- if t > 0 then more than 1 rectangle
+ = Pictures
+    [ part0
+    ,Translate 0 (100) 
+        $ Scale 0.8 0.8 
+        $ Rotate (t * 5)
+        $ animation (t * 1.5) (d - 1),
+        
+    part1                         --part1 
+    ,Translate (0) (-100) 
+        $ Scale 0.8 0.8 
+        $ Rotate (t * 5) 
+        $ animation (t * 1.5) (d - 1)
+    ]
+    
+part0   = Pictures
+        [  Color (makeColor 1.0 0.0 0.0 0.8) $ rectangleUpperSolid 400 10 ]
+        
+part1   = Pictures
+        [  Color (makeColor 0.0 0.0 1.0 0.8) $ rectangleUpperSolid 400 10 ]
+
+part2   = Pictures
+        [  Color (makeColor 1.0 0.0 0.0 0.8) $ rectangleUpperSolid 400 10 ]
+        
+part3   = Pictures
+        [  Color (makeColor 0.0 0.0 1.0 0.8) $ rectangleUpperSolid 400 10 ]     
+ license view
@@ -0,0 +1,19 @@+The MIT License (MIT)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+ mcmaster-gloss-examples.cabal view
@@ -0,0 +1,52 @@+name: mcmaster-gloss-examples
+version: 2013
+category: Graphics
+description: A collection of simple gloss examples written by first year students at McMaster University. 
+cabal-version: >= 1.8
+build-type: Simple
+maintainer: toporoy@mcmaster.ca, anandc@mcmaster.ca
+homepage: http://www.cas.mcmaster.ca/~anand/
+license: MIT
+license-file: license
+
+Executable moving-star
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        MovingStar.hs
+  ghc-options: -O2
+
+Executable haunted-house
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        HauntedHouse.hs
+  ghc-options: -O2
+
+Executable solar-system
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        SolarSystem.hs
+  ghc-options: -O2
+
+Executable parabolic
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        Parabolic.hs
+  ghc-options: -O2
+
+Executable stare
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        Stare.hs
+  ghc-options: -O2
+
+Executable waves
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        Waves.hs
+  ghc-options: -O2
+
+Executable windmills
+  Build-Depends:  base == 4.6.* , gloss == 1.8.*
+  hs-source-dirs: .
+  Main-Is:        Windmills.hs
+  ghc-options: -O2