RosettaCodeData/Task/Fractal-tree/Haskell/fractal-tree-1.hs

13 lines
442 B
Haskell
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
import Graphics.Gloss
type Model = [Picture -> Picture]
fractal :: Int -> Model -> Picture -> Picture
fractal n model pict = pictures $ take n $ iterate (mconcat model) pict
2017-09-23 10:01:46 +02:00
tree1 _ = fractal 10 branches $ Line [(0,0),(0,100)]
where branches = [ Translate 0 100 . Scale 0.75 0.75 . Rotate 30
, Translate 0 100 . Scale 0.5 0.5 . Rotate (-30) ]
2016-12-05 22:15:40 +01:00
main = animate (InWindow "Tree" (800, 800) (0, 0)) white $ tree1 . (* 60)