1
0
Fork 0
freesewing/packages/tutorial/src/step6.js

24 lines
845 B
JavaScript
Raw Normal View History

2021-01-31 09:22:15 +01:00
export default function (part) {
2019-08-03 15:03:33 +02:00
let { Point, points, Path, paths } = part.shorthand()
2019-05-30 21:19:06 +02:00
2019-08-03 15:03:33 +02:00
points.edgeLeft = new Point(points.topLeft.x, points.left.y)
points.edgeRight = new Point(points.topRight.x, points.right.y)
points.edgeTop = new Point(0, points.topLeft.y)
2019-05-30 21:19:06 +02:00
2019-08-03 15:03:33 +02:00
points.edgeLeftCp = points.edgeLeft.shiftFractionTowards(points.topLeft, 0.5)
points.edgeRightCp = points.edgeLeftCp.flipX()
points.edgeTopLeftCp = points.edgeTop.shiftFractionTowards(points.topLeft, 0.5)
points.edgeTopRightCp = points.edgeTopLeftCp.flipX()
2019-05-30 21:19:06 +02:00
paths.rect = new Path()
.move(points.edgeTop)
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.edgeRight)
.curve(points.edgeRightCp, points.edgeTopRightCp, points.edgeTop)
2019-08-03 15:03:33 +02:00
.close()
2019-05-30 21:19:06 +02:00
2019-08-03 15:03:33 +02:00
return part
2019-05-30 21:19:06 +02:00
}