Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Monday, 22 June 2009

Context Free For Little People

A fellow traveller on the mass writing project, came up with an interesting little application in processing "Cross Stitch for Little People" which featured a multi button input to choose colors. I had this wild thought what about producing a generator for context free that could be used by children? First thing I wanted to do was get all the colors out in a grid (PS if ever get to implementation stage it will likely to be python/ruby).

Heres the swatch I produced, and the rules that produced it. It features simple and complex looping in context free.



   1:startshape swatch
2:
3:rule swatch {
4: 19 * {h 1 x 1.5} {
5: 19 *{ h 19 y 1.5} SQUARE {sat 1 b 1}
6: }
7:}


Here is a variant to give slight 3d look

   1:startshape swatch
2:background{b -1}
3:
4:rule swatch{
5: gradient {b 1}
6: 1 * {size 0.95} gradient {x 0.2 y -0.2 b 0.5}
7:}
8:
9:rule gradient {
10: 19 * {h 1 x 1.5} {
11: 19 *{ h 19 y 1.5} SQUARE {size 1 1 sat 1}
12: }
13:}




Exploring the influence of saturation and brightness in cfdg

   1:startshape colours
2:background{b -1} // looks better on dark background
3:rule colours{
4: swatch{b 1 sat 1} // full saturation full brightness
5: swatch{x 20 b 1 sat 0.7}
6: swatch{x 40 b 1 sat 0.4}
7: swatch{y -20 b 0.5 sat 1}
8: swatch{y -20 x 20 b 0.5 sat 0.7}
9: swatch{y -20 x 40 b 0.5 sat 0.4} //reduced brightness and saturation
10:}
11:
12:rule swatch {
13: 19 * {h 1 x 1} {
14: 19 *{ h 19 y 1} SQUARE {}
15: }
16:}




There probably ought be a rule a against it but you can nest your nested loops to create quite a structure:

   1:startshape colours
2:
3:rule colours{
4: swatch{b 1.3 sat 1.3} // start full + 0.3 hack
5:}
6:
7:rule swatch{ // decrement saturation and brightness on loops
8: 3 * {x 19 sat -0.3}{
9: 2 * {y -19 b -0.3} grid{}
10: }
11:}
12:
13:rule grid { // increment hue on loop
14: 19 * {h 1 x 1} {
15: 19 *{ h 19 y -1} SQUARE {}
16: }
17:}


No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2