Graphics.CanvasAction.Transformation
- Package
- purescript-canvas-action
- Repository
- 3ddyy/purescript-canvas-action
This module defines a free monad for working with canvas transformations in
a more pleasant way. Construct transforms with the various functions, like
translate
, scale
and fullMatrix
. There are also alternate functions
(denoted by a '
), which take the dedicated data type for that transform,
instead of Number
s, as arguments. Perform a transform with
runTransform
, or use transformed
to also reset the transformation
matrix to its previous value afterwards.
#TransformationM Source
type TransformationM = Free TransformationF
#Transformation Source
type Transformation = TransformationM Unit
#translate Source
translate :: Number -> Number -> Transformation
Construct a Transformation
from two Number
s representing translation
#translate' Source
translate' :: TranslateTransform -> Transformation
Construct a Transformation
from a TranslateTransform
#scale Source
scale :: Number -> Number -> Transformation
Construct a Transformation
from two Number
s representing scaling
#scale' Source
scale' :: ScaleTransform -> Transformation
Construct a Transformation
from a ScaleTransform
#skew Source
skew :: Number -> Number -> Transformation
Construct a Transformation
from two Number
s representing skew
#skew' Source
skew' :: SkewTransform -> Transformation
Construct a Transformation
from a SkewTransform
#rotate Source
rotate :: Number -> Transformation
Construct a Transformation
from a Number
representing degrees rotated
#fullMatrix Source
fullMatrix :: Number -> Number -> Number -> Number -> Number -> Number -> Transformation
Construct a Transformation
from six Number
s representing a full
matrix transformation
#fullMatrix' Source
fullMatrix' :: FullMatrixTransform -> Transformation
Construct a Transformation
from a FullMatrixTransform
#runTransform Source
runTransform :: TransformationM ~> CanvasActionM
Run a transformation
#transformed Source
transformed :: forall a. Transformation -> CanvasActionM a -> CanvasActionM a
Run a transformation on a CanvasActionM
, transforming back afterwards