|
|
|
@ -136,7 +136,7 @@ function sierpinski() {
@@ -136,7 +136,7 @@ function sierpinski() {
|
|
|
|
|
function barnsley_fern() { |
|
|
|
|
project.clear(); |
|
|
|
|
var r = generate( |
|
|
|
|
'IXF'.split(''), |
|
|
|
|
'iIXF'.split(''), |
|
|
|
|
[ |
|
|
|
|
['X'.split(''), 'F+[[X]-X]-F[-FX]+X'.split('')], |
|
|
|
|
['F'.split(''), 'FF'.split('')] |
|
|
|
@ -149,7 +149,8 @@ function sierpinski() {
@@ -149,7 +149,8 @@ function sierpinski() {
|
|
|
|
|
r, |
|
|
|
|
{ |
|
|
|
|
'F': draw_forward(), |
|
|
|
|
'I': draw_angle_init(25/180 * Math.PI), |
|
|
|
|
'i': draw_set_dir(Math.PI), |
|
|
|
|
'I': draw_angle_init(25/180 * Math.PI + Math.random() * 0.2), |
|
|
|
|
'-': draw_angle_turn(-1), |
|
|
|
|
'+': draw_angle_turn(1), |
|
|
|
|
'[': draw_state_push(), |
|
|
|
@ -157,7 +158,7 @@ function sierpinski() {
@@ -157,7 +158,7 @@ function sierpinski() {
|
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
p.scale(2); |
|
|
|
|
p.translate(new Point(200, 200)); |
|
|
|
|
p.translate(new Point(200, 300)); |
|
|
|
|
p.strokeWidth = 1; |
|
|
|
|
p.strokeColor = '#ff00ff'; |
|
|
|
|
} |
|
|
|
|