-
Notifications
You must be signed in to change notification settings - Fork 14
Square
RyanGlScott edited this page Oct 9, 2014
·
5 revisions
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Graphics.Blank
main :: IO ()
main = blankCanvas 3000 { events = ["mousedown"] } $ \ context -> do
let loop (x,y) (color:colors) = do
send context $ saveRestore $ do
translate (x,y)
beginPath()
moveTo(-100,-100)
lineTo(-100,100)
lineTo(100,100)
lineTo(100,-100)
closePath()
lineWidth 10
strokeStyle color
stroke()
eMetaKey = False
, ePageXY = return (x',y')
, eType = "mousedown"
, eWhich = Nothing
}
event <- wait context
case ePageXY event of
Nothing -> loop (x,y) colors
Just (x',y') -> loop (x',y') colors
putStrLn "calling size"
loop (width context / 2,height context / 2)
(cycle [ "#749871", "#1887f2", "#808080", "f01234"])