|
|
@ -70,21 +70,21 @@ function draw_initstate(p, state) { |
|
|
|
function draw_set_dir(dir) { |
|
|
|
function draw_set_dir(dir) { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
state.dir = dir; |
|
|
|
state.dir = dir; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function draw_set_turn_noise(level) { |
|
|
|
function draw_set_turn_noise(level) { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
state.turnnoise = level; |
|
|
|
state.turnnoise = level; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function draw_set_length_noise(level) { |
|
|
|
function draw_set_length_noise(level) { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
state.lennoise = level; |
|
|
|
state.lennoise = level; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -101,7 +101,7 @@ function draw_forward(factor=1) { |
|
|
|
Math.sin(state.dir) * state.stepsize * factor * noise, |
|
|
|
Math.sin(state.dir) * state.stepsize * factor * noise, |
|
|
|
Math.cos(state.dir) * state.stepsize * factor * noise |
|
|
|
Math.cos(state.dir) * state.stepsize * factor * noise |
|
|
|
))); |
|
|
|
))); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +122,7 @@ function draw_turn(angle) { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
draw_initstate(p, state); |
|
|
|
draw_initstate(p, state); |
|
|
|
state.dir += angle; |
|
|
|
state.dir += angle; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -131,21 +131,21 @@ function draw_angle_turn(fac) { |
|
|
|
draw_initstate(p, state); |
|
|
|
draw_initstate(p, state); |
|
|
|
var a = state.angle * (1 + (Math.random() - 0.5) * state.turnnoise); |
|
|
|
var a = state.angle * (1 + (Math.random() - 0.5) * state.turnnoise); |
|
|
|
state.dir += a * fac; |
|
|
|
state.dir += a * fac; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function draw_angle_init(angle) { |
|
|
|
function draw_angle_init(angle) { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
state.angle = angle; |
|
|
|
state.angle = angle; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function draw_angle_add(delta) { |
|
|
|
function draw_angle_add(delta) { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
state.angle += delta; |
|
|
|
state.angle += delta; |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -159,7 +159,7 @@ function draw_state_push() { |
|
|
|
dir: state.dir, |
|
|
|
dir: state.dir, |
|
|
|
stepsize: state.stepsize, |
|
|
|
stepsize: state.stepsize, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -171,7 +171,7 @@ function draw_state_pop() { |
|
|
|
p.addChild(new paper.Path()); |
|
|
|
p.addChild(new paper.Path()); |
|
|
|
state.curpath = p.lastChild; |
|
|
|
state.curpath = p.lastChild; |
|
|
|
state.curpath.add(s.pos); |
|
|
|
state.curpath.add(s.pos); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|