@@ -14,6 +14,7 @@ type Form = {
14 scale : Float,
14 scale : Float,
15 x : Float,
15 x : Float,
16 y : Float,
16 y : Float,
17 form : BasicForm
18 form : BasicForm
@@ -75,7 +76,8 @@ data BasicForm
75 | FElement Element
76 | FElement Element
76 | FGroup Matrix2D [Form]
77 | FGroup Matrix2D [Form]
79+form : BasicForm -> Form
78−form f = { theta = 0, scale = 1, x = 0, y = 0, form = f }
80+form f = { theta=0, scale=1, x=0, y=0, alpha=1, form=f }
80fill style shape = form (FShape (Either.Right style) shape)
82fill style shape = form (FShape (Either.Right style) shape)
@@ -147,6 +149,10 @@ moveX x f = { f | x <- f.x + x }
147moveY : Float -> Form -> Form
149moveY : Float -> Form -> Form
148moveY y f = { f | y <- f.y + y }
150moveY y f = { f | y <- f.y + y }
152+-- Set the opacity of a `Form`. The default is 1, and 0 is totally transparent.
153+opacity : Float -> Form -> Form
154+opacity a f = { f | alpha <- a }
150-- A collage is a collection of 2D forms. There are no strict positioning
156-- A collage is a collection of 2D forms. There are no strict positioning
151-- relationships between forms, so you are free to do all kinds of 2D graphics.
157-- relationships between forms, so you are free to do all kinds of 2D graphics.
152collage : Int -> Int -> [Form] -> Element
158collage : Int -> Int -> [Form] -> Element