1
0
Fork 0
freesewing/packages/rendertest/src/circles.js

25 lines
596 B
JavaScript
Raw Normal View History

2019-05-07 12:50:49 +02:00
export default function(part) {
2019-08-03 15:03:33 +02:00
let { Point, Path, points, paths, store } = part.shorthand()
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
let y = store.get('y')
let w = store.get('w')
let colors = store.get('colors')
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
points.crl = new Point(0, y)
points.crr = new Point(w, y)
2019-05-07 12:50:49 +02:00
paths.circles = new Path()
.move(points.crl)
.line(points.crr)
2019-08-03 15:03:33 +02:00
.attr('data-text', 'circles')
y += w / 2
2019-05-07 12:50:49 +02:00
for (let i = 1; i < 50; i++) {
2019-08-03 15:03:33 +02:00
points['cr' + i] = new Point(w / 2, y)
.attr('data-circle', i * (w / 100))
.attr('data-circle-class', colors[i % colors.length])
2019-05-07 12:50:49 +02:00
}
2019-08-03 15:03:33 +02:00
y += w / 2
store.set('y', y)
2019-05-07 12:50:49 +02:00
2019-08-03 15:03:33 +02:00
return part
2019-05-07 12:50:49 +02:00
}