1
0
Fork 0
freesewing/packages/examples/src/path_ops.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-01-27 12:54:18 +01:00
export default part => {
let { Point, points, Path, paths } = part.shorthand();
2019-01-27 12:54:18 +01:00
points.A = new Point(10, 10)
.attr("data-text", "msg_move")
2019-01-27 12:54:18 +01:00
.attr("data-text-class", "center text-xs");
points.B = new Point(70, 30);
points.BCp2 = new Point(40, 10);
points.C = new Point(90, -50);
points.CCp1 = new Point(125, -30);
points.D = new Point(20, -50);
points.DCp = new Point(40, 0);
points.E = new Point(-20, -20);
points.ECp = new Point(-20, -50);
2019-01-27 12:54:18 +01:00
paths.line = new Path()
2019-01-27 12:54:18 +01:00
.move(points.A)
.line(points.B)
.attr("data-text", "msg_line")
.attr("data-text-class", "center text-xs");
2019-01-27 12:54:18 +01:00
paths.curve = new Path()
2019-01-27 12:54:18 +01:00
.move(points.B)
.curve(points.BCp2, points.CCp1, points.C)
.attr("data-text", "msg_curve")
.attr("data-text-class", "center text-xs");
2019-01-27 12:54:18 +01:00
paths._curve = new Path()
.move(points.C)
._curve(points.DCp, points.D)
.attr("data-text", "msg__curve")
2019-01-27 12:54:18 +01:00
.attr("data-text-class", "center text-xs");
paths.curve_ = new Path()
.move(points.D)
.curve_(points.ECp, points.E)
.attr("data-text", "msg_curve_")
2019-01-27 12:54:18 +01:00
.attr("data-text-class", "center text-xs");
paths.close = new Path()
.move(points.E)
.line(points.A)
.attr("data-text", "msg_close")
2019-01-27 12:54:18 +01:00
.attr("data-text-class", "center text-xs");
paths.example = paths.line
.join(paths.curve)
.join(paths._curve)
.join(paths.curve_)
.close();
2019-01-27 12:54:18 +01:00
return part;
};