Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. import Svg exposing (..)
  2. import Svg.Attributes exposing (..)
  3. import Html exposing (Html)
  4. import String
  5.  
  6.  
  7. main =
  8. svg [ version "1.1", x "0", y "0", viewBox "0 0 323.141 322.95" ]
  9. [ --polygon [ fill "#F0AD00", points "161.649,152.782 231.514,82.916 91.783,82.916" ] []
  10. --, polygon [ fill "#7FD13B", points "8.867,0 79.241,70.375 232.213,70.375 161.838,0" ] []
  11. rect
  12. [ fill "#7FD13B", x "192.99", y "107.392", width "107.676", height "108.167"
  13. , transform "matrix(0.7071 0.7071 -0.7071 0.7071 186.4727 -127.2386)"
  14. ]
  15. []
  16. -- , polygon [ fill "#60B5CC", points "323.298,143.724 323.298,0 179.573,0" ] []
  17. -- , polygon [ fill "#5A6378", points "152.781,161.649 0,8.868 0,314.432" ] []
  18. -- , polygon [ fill "#F0AD00", points "255.522,246.655 323.298,314.432 323.298,178.879" ] []
  19. -- , polygon [ fill "#60B5CC", points "161.649,170.517 8.869,323.298 314.43,323.298" ] []
  20. -- , line [ x1 "0", x2 "150", y1 "0", y2 "150" , stroke "rgb(255,0,0)", strokeWidth "2"] []
  21.  
  22. , nodeLine "40"
  23.  
  24. , nodeLine "80"
  25.  
  26. , nodeLine "120"
  27.  
  28. , nodeLine "160"
  29.  
  30. , line [ x1 "40", x2 "80", y1 "20", y2 "20" , stroke "rgb(255,0,0)", strokeWidth "0.8"] []
  31.  
  32. --, polyline [ points "77,17 80,20 77, 23", stroke "rgb(255,0,0)", fill "rgb(255,0,0)"] []
  33.  
  34. , polyline [ points (arrowhead 80 20), stroke "rgb(255,0,0)", fill "rgb(255,0,0)"] []
  35.  
  36. , arrow 40 80 120
  37.  
  38. ]
  39.  
  40. nodeLine vert = line [ x1 vert, x2 vert, y1 "0", y2 "300" , stroke "rgb(0,0,0)", strokeWidth "0.5"] []
  41.  
  42.  
  43. arrow level from to =
  44. svg [ version "1.1", x "0", y "0", viewBox "0 0 323.141 322.95" ]
  45. [
  46. line [ x1 (toString from), x2 (toString to), y1 (toString level), y2 (toString level) , stroke "rgb(255,0,0)", strokeWidth "0.8"] []
  47. , polyline [ points (arrowhead to level), stroke "rgb(255,0,0)", fill "rgb(255,0,0)"] []
  48. ]
  49.  
  50. arrowhead endX endY =
  51. let
  52. topTip = (endX - 3, endY + 3)
  53. middle = (endX, endY)
  54. bottomTip = (endX - 3, endY - 3)
  55. points = [topTip, middle, bottomTip]
  56. pointToString = \(a,b) -> (toString a) ++ "," ++ (toString b)
  57. in
  58. points
  59. |> List.map pointToString
  60. |> String.join " "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement