Popularity
4.4
Declining
Activity
0.0
Stable
4
3
3

Monthly Downloads: 19
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Graphics    
Latest version: v0.1.0.0

context-free-art alternatives and similar packages

Based on the "Graphics" category.
Alternatively, view context-free-art alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of context-free-art or a related project?

Add another 'Graphics' Package

README

Context free art

Create art via context free grammar production rules. Current backends: SVG.

Context free grammar primer

Context free grammars consist of a set of terminal symbols, a set of non-terminal symbols, and production rules that map non-terminals to other symbols.

With a context-free grammar, we can generate strings of terminals that conform to the specified language.

Our language will describe graphics.

How to use

import Art.ContextFree.Definite
import Data.List.NonEmpty

move = Mod [Move (0, -1.8), Scale 0.8]

armN :: Int -> Symbol
armN 0 = move $ Circle 1
armN n = move $ Branch $
  Circle 1 :| [Mod [Rotate 10] $ armN (n - 1)]

arm :: Symbol
arm = armN 20

spiral = Branch $
  Circle 1 :| [arm, Mod [Rotate 120] arm, Mod [Rotate 240] arm]

The latter produces this graphic:

spiral.svg

Examples

The code for these can be found in the exmaples/ folder

circles.svg sierpinski-triangle.svg sierpinski-carpet.svg