Skip to content

Commit b720e62

Browse files
committed
further code golf
1 parent 0a27163 commit b720e62

File tree

2 files changed

+774
-774
lines changed

2 files changed

+774
-774
lines changed

src/marks/vector.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ export class Vector extends Mark {
5454
.join("path")
5555
.call(applyDirectStyles, this)
5656
.attr("d", i => {
57-
const l = fl(i), r = l / 5, a = fr(i) * radians;
58-
const s = Math.sin(a), sl = s * l, sr = s * r;
59-
const c = Math.cos(a), cl = c * l, cr = c * r;
60-
return `M${fx(i) - sl * k},${fy(i) + cl * k}l${sl},${-cl}m${-cr - sr},${cr - sr}l${cr + sr},${sr - cr}l${cr - sr},${sr + cr}`;
57+
const l = fl(i), a = fr(i) * radians;
58+
const x = Math.sin(a) * l, y = -Math.cos(a) * l;
59+
const d = (x + y) / 5, e = (x - y) / 5;
60+
return `M${fx(i) - x * k},${fy(i) - y * k}l${x},${y}m${-e},${-d}l${e},${d}l${-d},${e}`;
6161
})
6262
.call(applyChannelStyles, this, channels))
6363
.node();

0 commit comments

Comments
 (0)