Created
September 17, 2015 11:01
-
-
Save mungojelly/d6b959a2cd2fbb11e03a to your computer and use it in GitHub Desktop.
This file contains 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 Mouse | |
import Color exposing (..) | |
import Graphics.Collage exposing (..) | |
import Window | |
main : Signal Element | |
main = | |
Signal.map2 scene Mouse.position Window.dimensions | |
scene : (Int,Int) -> (Int,Int) -> Element | |
scene (x,y) (w, h) = | |
let | |
(dx,dy) = | |
(toFloat x - toFloat w / 2, toFloat h / 2 - toFloat y) | |
in | |
collage w h | |
[ blueSquare |> move (dx, dy) ] | |
blueSquare : Form | |
blueSquare = | |
traced (dashed blue) square | |
square : Path | |
square = | |
path [ (50,50), (50,-50), (-50,-50), (-50,50), (50,50) ] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment