Skip to content

Instantly share code, notes, and snippets.

@vapidbabble
Created August 15, 2016 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vapidbabble/e70b8c0380b9898cd99da06a08c0fc37 to your computer and use it in GitHub Desktop.
Save vapidbabble/e70b8c0380b9898cd99da06a08c0fc37 to your computer and use it in GitHub Desktop.
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