starting an experiment with a layout generator

this will likely be in development for a long time, if it ever amounts
to anything at all
partial-rewrite
Ben Blazak 2014-05-29 23:16:44 -07:00
parent f980028d82
commit 5e931a7481
2 changed files with 34 additions and 0 deletions

28
layout-gen/main.elm Normal file
View File

@ -0,0 +1,28 @@
import Window
lightLightBlue : Color
lightLightBlue = rgba 114 159 207 0.5 -- lightBlue with alpha=0.5
main : Signal Element
main = background <~ Window.dimensions
background : (Int, Int) -> Element
background (w,h) =
let (xMax, yMax) = (toFloat w / 2, toFloat h / 2)
vtLine color = segment (0, -yMax) (0, yMax) |> traced (dashed color)
htLine color = segment (-xMax, 0) (xMax, 0) |> traced (dashed color)
vLineOffsets space = [floor (-xMax/space)..floor (xMax/space)]
hLineOffsets space = [floor (-yMax/space)..floor (yMax/space)]
in color lightGray <| collage w h (
vtLine black :: htLine black ::
(map (\x -> vtLine (if mod x 2 == 1 then lightBlue else lightLightBlue)
|> move (toFloat x * 35, 0))
(vLineOffsets 35)) ++
(map (\y -> htLine (if mod y 2 == 1 then lightBlue else lightLightBlue)
|> move (0, toFloat y * 35))
(hLineOffsets 35))
)

6
layout-gen/readme.md Normal file
View File

@ -0,0 +1,6 @@
This might eventually become a layout generator :) . Until then, it's an
experiment.
## TODO:
- update readme with useful information (once we've gotten anywhere)