Created
January 18, 2016 23:48
-
-
Save fredguth/30386edec145f15a2f7f to your computer and use it in GitHub Desktop.
Following Elm Tutorial (https://www.youtube.com/watch?v=6PDvHveBtDQ)
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 Graphics.Element exposing (..) | |
import Graphics.Collage exposing (..) | |
import Color exposing (..) | |
import Mouse | |
import Window | |
relativeMouse : (Int, Int) -> (Int, Int) -> (Int, Int) | |
relativeMouse (origin_x, origin_y) (x, y) = | |
(x-origin_x, origin_y - y) | |
center : (Int, Int) -> (Int, Int) | |
center (w,h) = | |
(w//2, h//2) | |
render (x,y) = | |
let forms = [circle 15 |> filled lightBlue | |
|> move (toFloat x, toFloat y)] | |
in | |
color gray <| collage 400 400 forms | |
main = Signal.map render <| Signal.map (relativeMouse (200,200)) Mouse.position |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Part 2: https://gist.github.com/fredguth/aa87dc1cba583a78738f