Browse Source

use correct syntax

master
Fr3deric 5 years ago
parent
commit
e76e7e21dd
  1. 20
      lindenmayer-system/lindenmeyer-system.js

20
lindenmayer-system/lindenmeyer-system.js

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

Loading…
Cancel
Save