I just started experimenting with ContextFreeArt and so my practicing designs are nothing special yet.
I wanted to create a meadow of flowers.
I have problems understanding the way the movement works though. I move around in my START rule, but is there a way, I can move in one of those child rules resulting in a change of position in the START rule?
For example, once the program has completed a flower, I want the position to be moved to the right, so the flowers don't overlap. How can that be done?
Most of the changes I make are just trial and error. It would be perfect if I could slowly move through the program, so I learn to understand which command does what. Is there a way to do that?
Not part of this program, but is there a way to interact between the background and the thing being printed on it? Like, can I have the object react to the background, for example blue background plus yellow object results in green object?
Oh, of course like everybody I would love more randomness.
And then, what about variables?
Matthias
Code: Select all
startshape START
rule START {
10 * {x 6} WALK {x 4}
}
rule WALK 1 { CIRCLE {} WALK { x 3 y 1} }
rule WALK 1 { SQUARE {} WALK { x 3 y -1} }
rule WALK 0.3 { BLUME{ x 3} }
//flower
rule BLUME {
5 * {y 1} SQUARE {x 0 y 1 h 120 sat 1 b 1}
STENGEL {y 5}
}
// stem
rule STENGEL 1{
SQUARE {x 0 y 1 h 120 sat 1 b 1}
STENGEL {x 0 y 1 }
}
rule STENGEL 0.2 {
BLAETTER {}
3 * {y 1 } SQUARE {x 0 y 1 h 120 sat 1 b 1}
STENGEL {x 0 y 1 }
}
rule STENGEL 0.1 {
BLUETE {}
}
//leaves left and right
rule BLAETTER 0.5 {
BLATT {r 60 h 120 sat 1 b 1 z 1}
}
rule BLAETTER 0.5 {
BLATT {r -60 h 120 sat 1 b 1 z 1}
}
//blossoms
rule BLUETE {
CIRCLE {s 2 h rand_static (180,420) sat 1 b 1 z 3}
6* {r 60} { BLATT { h rand_static (180,420) sat 1 b 1 z 2}}
}
rule BLUETE {
CIRCLE {s 2 h rand_static (180,420) sat 1 b 1 z 3}
6* {r 60} { BLATT { h rand_static (180,420) sat 1 b 1 z 2}}
}
path BLATT {
MOVETO{}
CURVEREL{x 0 y 4 x1 2 y1 2}
CURVEREL{x 0 y -4 x1 -2 y1 -2}
//STROKE{ width 0.3}
FILL {}
}