Created
August 15, 2016 21:25
-
-
Save vapidbabble/e70b8c0380b9898cd99da06a08c0fc37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Color exposing (..) | |
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
hexagon : Color -> Form | |
hexagon clr = outlined (solid clr) (ngon 6 150) | |
hex_on_a_point : Float -> Color -> Form | |
hex_on_a_point deg clr = rotate (degrees deg) (hexagon clr) | |
uni_path : Shape | |
uni_path = | |
let radius = 150 | |
angle = 30 | |
radians= angle/180.0 * pi | |
factor1 = cos radians | |
factor2 = sin radians | |
number = factor1 * radius | |
half = factor2 * radius | |
in | |
polygon [ | |
(0,radius), | |
(-number,-half), | |
(number,half), | |
(0,-radius), | |
(-number,half), | |
(number,-half) | |
] | |
unicursal : Color -> Form | |
unicursal clr = outlined (solid clr) uni_path | |
main : Element | |
main = | |
collage 300 300 | |
[ filled black (circle 150) | |
, hex_on_a_point 90 green | |
, unicursal red | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment