Add support for negative `frame` value

This commit is contained in:
yuanchuan 2021-10-30 13:09:42 +08:00
parent b02a325317
commit f9850c3b4d
1 changed files with 4 additions and 4 deletions

View File

@ -154,9 +154,9 @@ function create_polygon_points(option, fn) {
}
let split = option.split || 180;
let scale = Number(option.scale) || 1;
let turn = Number(option.turn) || 1;
let frame = Number(option.frame) || 1;
let scale = option.scale || 1;
let turn = option.turn || 1;
let frame = option.frame;
let fill = option['fill'] || option['fill-rule'];
let rad = (PI * 2) * turn / split;
@ -188,7 +188,7 @@ function create_polygon_points(option, fn) {
add(first_point);
let w = frame / 100;
if (turn > 1) w *= 2;
if (w <= 0) w = .002;
if (w == 0) w = .002;
for (let i = 0; i < split; ++i) {
let t = -rad * i;
let [x, y, dx = 0, dy = 0] = fn(t, i);