Graphics.CanvasAction.Transformation
- Package
- purescript-canvas-action
- Repository
- artemisSystem/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 matrixTransform. There are also alternate
functions (denoted by a '), which take the dedicated data type for that
transform, instead of Numbers, 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#resetTransform Source
resetTransform :: TransformationReset the transformation matrix to its default value
#setTransform Source
setTransform :: Number -> Number -> Number -> Number -> Number -> Number -> TransformationConstruct a Transformation from six Numbers representing a matrix
transformation, replacing the current matrix
#setTransform' Source
setTransform' :: MatrixTransform -> TransformationConstruct a Transformation from a MatrixTransform, replacing the
current matrix
#getTransform Source
getTransform :: TransformationM MatrixTransformGet the current transformation matrix
#translate Source
translate :: Number -> Number -> TransformationConstruct a Transformation from two Numbers representing translation
#translate' Source
translate' :: TranslateTransform -> TransformationConstruct a Transformation from a TranslateTransform
#scale Source
scale :: Number -> Number -> TransformationConstruct a Transformation from two Numbers representing scaling
#scale' Source
scale' :: ScaleTransform -> TransformationConstruct a Transformation from a ScaleTransform
#skew Source
skew :: Number -> Number -> TransformationConstruct a Transformation from two Numbers representing skew
#skew' Source
skew' :: SkewTransform -> TransformationConstruct a Transformation from a SkewTransform
#rotate Source
rotate :: Number -> TransformationConstruct a Transformation from a Number representing radians rotated
#matrixTransform Source
matrixTransform :: Number -> Number -> Number -> Number -> Number -> Number -> TransformationConstruct a Transformation from six Numbers representing a matrix
transformation, multiplying the new matrix with the current matrix
#matrixTransform' Source
matrixTransform' :: MatrixTransform -> TransformationConstruct a Transformation from a MatrixTransform, multiplying the
new matrix with the current matrix
#runTransform Source
runTransform :: forall m. MonadCanvasAction m => MonadRec m => TransformationM ~> mRun a transformation
#transformed Source
transformed :: forall a m. MonadCanvasAction m => MonadRec m => Transformation -> m a -> m aRun a transformation on a MonadCanvasAction, transforming back afterwards