Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import Color exposing (..)
  2. import Graphics.Collage exposing (..)
  3. import Graphics.Element exposing (..)
  4.  
  5. hexagon : Color -> Form
  6. hexagon clr = outlined (solid clr) (ngon 6 150)
  7.  
  8. hex_on_a_point : Float -> Color -> Form
  9. hex_on_a_point deg clr = rotate (degrees deg) (hexagon clr)
  10.  
  11.  
  12. uni_path : Path
  13. uni_path =
  14. let radius = 150
  15. angle = 30
  16. radians= angle/180.0 * pi
  17. factor1 = cos radians
  18. factor2 = sin radians
  19. number = factor1 * radius
  20. half = factor2 * radius
  21. in
  22. path [
  23. (0,radius),
  24. (-number,-half),
  25. (number,half),
  26. (0,-radius),
  27. (-number,half),
  28. (number,-half),
  29. (0,radius)
  30. ]
  31.  
  32. unicursal : Color -> Form
  33. unicursal clr = outlined (solid clr) uni_path
  34.  
  35. main : Element
  36. main =
  37. collage 300 300
  38. [ filled black (circle 150)
  39. , hex_on_a_point 90 green
  40. , unicursal red
  41. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement