Skip to content

Translate Transform

Andy Gill edited this page Jun 18, 2014 · 4 revisions

«html5canvastutorials version»

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Graphics.Blank

main = blankCanvas 3000 $ \ context -> do
    send context $ do
        (width,height) <- size
        let rectWidth = 150;
        let rectHeight = 75;
        translate(width / 2, height / 2);
        fillStyle "blue";
        fillRect(rectWidth / (-2), rectHeight / (-2), rectWidth, rectHeight);
Clone this wiki locally