Module
Graphics.CanvasAction.Path
- Package
- purescript-canvas-action
- Repository
- 3ddyy/purescript-canvas-action
This module defines a free monad for working with canvas paths in a more
pleasant way. Make your paths by combining lineTo
, moveTo
, arc
,
rect
, quadraticCurveTo
, bezierCurveTo
, and closePath
using <>
or
bind
(do
notation), and use them with fillPath
, fillPathWith
,
strokePath
, strokePathWith
, and clip
.
Example:
action :: CanvasAction
action = fillPathWith "red" path
path :: Path
path = do
moveTo (100.0 >< 100.0)
lineTo (200.0 >< 10.0)
lineTo (10.0 >< 100.0)
closePath
polygon
[ 0.0 >< 0.0
, 20.0 >< 200.0
, 100.0 >< 175.0
, 30.0 >< 150.0
]
circle (100.0 >< 100.0) 50.0
action
is a CanvasAction
that can be run in Effect
with runAction
from Graphics.CanvasAction
.
#bezierCurveTo Source
bezierCurveTo :: BezierCurve -> Path
#fillPathWith Source
fillPathWith :: forall r m. MonadCanvasAction m => MonadRec m => CanvasStyleRep r => r -> PathM ~> m
#strokePath Source
strokePath :: forall m. MonadCanvasAction m => MonadRec m => PathM ~> m
#strokePathWith Source
strokePathWith :: forall r m. MonadCanvasAction m => MonadRec m => CanvasStyleRep r => r -> PathM ~> m