Skip to content

Instantly share code, notes, and snippets.

@fredguth
Created January 18, 2016 23:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredguth/30386edec145f15a2f7f to your computer and use it in GitHub Desktop.
Save fredguth/30386edec145f15a2f7f to your computer and use it in GitHub Desktop.
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
@fredguth
Copy link
Author

@fredguth
Copy link
Author

@dptole
Copy link

dptole commented Feb 15, 2016

Worth to mention that this code is a more updated version of the code in this playlist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment