What is it? CFDG is a simple programming language for generating pictures. It is based on syntax invented by Chris Coyne. You specify a program consising of drawing rules, and a start rule. You can have multiple (conflicting) rules. When this happens, CFDG picks one randomly. Infinite loops are okay, as long as the shapes get infinitely small. The full syntax is described here.



This version of CFDG is written in pure PHP, it's platform-independent and relatively fast.



Your feedback is essential! Please send me your comments and suggestions.

Give it a try! Enter or paste your CFDG program below, then click 'Run' to execute it:



width = 400 height = 400 //initial values: s = 30 //size b = 220 //brightness (0..255) r = 0 //rotation angle (0..360 degrees) c = 0 //color (0..255) t = 200 //saturation (0..255) a = 0 //alpha channel (0 = opaque to 255 = transparent) n = 70 //nesting: max. level of recursion startshape FIRST //start with this rule rule FIRST { BRICK //without parameters, parentheses may be omitted //parameters may be contracted to 1st letter, e.g. 's' for 'size' BRICK {r 72 c 51} BRICK {r 144 c 102} BRICK {r 216 c 153} BRICK {r 288 c 204} //absolute values are also supported now. //Put '=' sign before a value: CIRCLE {s =45 t =0 b =200} } //probabilities (rules weightings) are supported (0..1): rule BRICK 0.5 { SQUARE BRICK {r -20 x 1.3 s 0.9 b -0.1} //'b': brightness (-1..+1) } rule BRICK { SQUARE BRICK {r -20 x 1.3 s 0.9 b -0.1} }



(The result will be opened in a new window)