Skip to content
Andy Gill edited this page Jun 20, 2014 · 5 revisions

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Graphics.Blank

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()



                event <- wait context
                case ePageXY event of
                        Nothing -> loop (x,y) colors
                        Just (x',y') -> loop (x',y') colors

          print "calling size"                
          loop (width context / 2,height context / 2)
               (cycle [ "#749871", "#1887f2", "#808080", "f01234"])
Clone this wiki locally