Module

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 Numbers, as arguments. Perform a transform with runTransform, or use transformed to also reset the transformation matrix to its previous value afterwards.

#TransformationF Source

#translate Source

translate :: Number -> Number -> Transformation

Construct a Transformation from two Numbers representing translation

#translate' Source

translate' :: TranslateTransform -> Transformation

Construct a Transformation from a TranslateTransform

#scale Source

scale :: Number -> Number -> Transformation

Construct a Transformation from two Numbers representing scaling

#scale' Source

scale' :: ScaleTransform -> Transformation

Construct a Transformation from a ScaleTransform

#skew Source

skew :: Number -> Number -> Transformation

Construct a Transformation from two Numbers 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 radians rotated

#fullMatrix Source

fullMatrix :: Number -> Number -> Number -> Number -> Number -> Number -> Transformation

Construct a Transformation from six Numbers representing a full matrix transformation

#fullMatrix' Source

fullMatrix' :: FullMatrixTransform -> Transformation

Construct a Transformation from a FullMatrixTransform

#runTransform Source

runTransform :: forall m. MonadCanvasAction m => MonadRec m => TransformationM ~> m

Run a transformation

#transformed Source

transformed :: forall m a. MonadCanvasAction m => MonadRec m => Transformation -> m a -> m a

Run a transformation on a MonadCanvasAction, transforming back afterwards