Browse Source

add parameter for connection line distance

master
Fr3deric 6 years ago
parent
commit
b123f8ad5d
  1. 9
      chaostest/connected-lines.html
  2. 6
      chaostest/connected-lines.js

9
chaostest/connected-lines.html

@ -89,7 +89,14 @@ window.onload = function() { @@ -89,7 +89,14 @@ window.onload = function() {
minimum: 1,
maximum: 10,
format: 'range'
}
},
line_distance: {
type: 'number',
minimum: 0,
maximum: 0.05,
format: 'range',
step: 0.0001,
},
}
}
});

6
chaostest/connected-lines.js

@ -6,6 +6,7 @@ function connected_lines_get_rnd_params() { @@ -6,6 +6,7 @@ function connected_lines_get_rnd_params() {
offs_x: 0.05,
offs_y: 0.05,
num_steps: 5,
line_distance: 7/500,
};
}
@ -40,9 +41,8 @@ function connected_lines(params) { @@ -40,9 +41,8 @@ function connected_lines(params) {
var o1start = lines[1].getOffsetOf(lines[1].segments[i].point);
var o1end = lines[1].getOffsetOf(lines[1].segments[i+1].point);
// TODO param: conn lines density
var num_steps2_0 = (o0end - o0start) / (7/500);
var num_steps2_1 = (o1end - o1start) / (7/500);
var num_steps2_0 = (o0end - o0start) / params.line_distance;
var num_steps2_1 = (o1end - o1start) / params.line_distance;
var num_steps2 = Math.min(num_steps2_0, num_steps2_1);
for(var j=0; j<num_steps2; j++) {
var p0 = lines[0].getPointAt(o0start + (o0end-o0start) * (j/num_steps2));

Loading…
Cancel
Save