Page 1 of 1

Clone statement for random shapes

Posted: Mon Feb 04, 2013 7:26 am
by DeFleur
I tried

Code: Select all

startshape TestClone
CF::Impure=1

shape RANd 
rule {CIRCLE [h 0 sat 1 b 1]}
rule {SQUARE [h 120 sat 1 b 1]}
rule {TRIANGLE [h 240 sat 1 b 1]}

shape TestClone {
loop 3 [y -1] loop 2 [x 1] clone [b -1] RANd [ ]
} 
hoping that in column x=1 same random shapes (a clone)
to appear (in black) as in column x=0. However,
the code does not provide this result and all 6 shapes are
random and colored. I try to achieve that a random shape
can be clone-repeated for adjustments (color, skew etc).
Advise is very much appreciated.

Re: Clone statement for random shapes

Posted: Mon Feb 04, 2013 6:06 pm
by MtnViewJohn
When you clone shapes you need to have an adjustment for each clone:

Code: Select all

startshape TestClone
CF::Impure=1

shape RANd 
rule {CIRCLE [h 0 sat 1 b 1]}
rule {SQUARE [h 120 sat 1 b 1]}
rule {TRIANGLE [h 240 sat 1 b 1]}

shape TestClone {
 clone [x 0 0], [x 1 0], 
       [x 0 1], [x 1 1], 
       [x 0 2], [x 1 2] RANd[b -1]
}
There is no construct for cloning loops.

Re: Clone statement for random shapes

Posted: Tue Feb 05, 2013 3:14 am
by DeFleur
I see. So I tried

Code: Select all

startshape TestClone
CF::Impure=1

shape RANd 
rule {CIRCLE [h 0 sat 1 b 1]}
rule {SQUARE [s .95 h 120 sat 1 b 1]}
rule {TRIANGLE [h 240 sat 1 b 1]}


shape TestClone {
clone [x 0 y 0], [x 1 y 0 s .5 h 60 b -.5] RANd [ ]
clone [x 0 y 1], [x 1 y 1 s .5 h 60 b -.5] RANd [ ]
clone [x 0 y 2], [x 1 y 2 s .5 h 60 b -.5] RANd [ ]
}
I can visualize the impact of the shape adjustment (s .5 h 60) on
shapes x=1 but can't get the impact on brightness reduction b -.5
to get them darker. I use CF 3.0.5. Any advice ?

Re: Clone statement for random shapes

Posted: Tue Feb 05, 2013 2:02 pm
by MtnViewJohn
The default brightness is 0, so b -0.5 does nothing. Furthermore, the b 1 in your RANd rules always sets the brightness to 1.

Code: Select all

startshape TestClone
CF::Impure=1

shape RANd 
rule {CIRCLE [h 0 sat 1]}
rule {SQUARE [s .95 h 120 sat 1]}
rule {TRIANGLE [h 240 sat 1]}


shape TestClone {
clone [x 0 y 0 b 1], [x 1 y 0 s .5 h 60 b .5] RANd [ ]
clone [x 0 y 1 b 1], [x 1 y 1 s .5 h 60 b .5] RANd [ ]
clone [x 0 y 2 b 1], [x 1 y 2 s .5 h 60 b .5] RANd [ ]
}

Re: Clone statement for random shapes

Posted: Wed Feb 06, 2013 8:41 am
by DeFleur
Clear and straight. Admit that default b 0 I could have known.
Thank you for your effort.