76 lines
2.9 KiB
JavaScript
76 lines
2.9 KiB
JavaScript
![]() |
export default function(part) {
|
||
|
let { sa, snippets, Snippet, utils, store, complete, points, measurements, options, macro, Point, paths, Path } = part.shorthand();
|
||
|
|
||
|
// Vent
|
||
|
let slope = 15;
|
||
|
let width = measurements.wristCircumference * (1 + options.cuffEase) * options.sleeveVentWidth;
|
||
|
points.ventFoldRight = points.usWristLeft.shiftOutwards(points.usWristRight, width);
|
||
|
points.ventHelper = points.usWristRight.shiftFractionTowards(points.elbowRight, options.sleeveVentLength);
|
||
|
points.ventSlopeEnd = points.ventHelper
|
||
|
.shiftTowards(points.usWristRight, width)
|
||
|
.rotate(90, points.ventHelper);
|
||
|
points.ventSlopeStart = utils.beamsIntersect(
|
||
|
points.usWristRight, points.elbowRight,
|
||
|
points.ventSlopeEnd, points.ventHelper.rotate(-1 * slope, points.ventSlopeEnd)
|
||
|
);
|
||
|
|
||
|
// Hem
|
||
|
let hemSa = sa ? 3*sa : 30;
|
||
|
points.hemHelperLeft = points.usWristLeft
|
||
|
.shiftTowards(points.usWristRight, hemSa)
|
||
|
.rotate(90, points.usWristLeft);
|
||
|
points.hemHelperRight = points.usWristRight
|
||
|
.shiftTowards(points.usWristLeft, hemSa)
|
||
|
.rotate(-90, points.usWristRight);
|
||
|
points.hemLeftIntersection = utils.beamsIntersect(
|
||
|
points.hemHelperLeft, points.hemHelperRight,
|
||
|
points.usWristLeft, points.usElbowLeft
|
||
|
);
|
||
|
points.hemRightIntersection = utils.beamsIntersect(
|
||
|
points.hemHelperLeft, points.hemHelperRight,
|
||
|
points.usWristRight, points.elbowRight
|
||
|
);
|
||
|
points.hemVentIntersection = utils.beamsIntersect(
|
||
|
points.hemHelperLeft, points.hemHelperRight,
|
||
|
points.ventFoldRight, points.ventSlopeEnd
|
||
|
);
|
||
|
points.hemLeft = points.hemLeftIntersection
|
||
|
.rotate(points.usWristLeft.angle(points.hemLeftIntersection) * -2, points.usWristLeft);
|
||
|
points.hemRight = points.hemRightIntersection
|
||
|
.rotate(points.usWristRight.angle(points.hemRightIntersection) * -2, points.usWristRight);
|
||
|
points.ventRight = points.hemVentIntersection
|
||
|
.rotate(points.ventFoldRight.angle(points.hemVentIntersection) * -2, points.ventFoldRight);
|
||
|
|
||
|
// Clean up - Remove this and uncomment paths below to understand what's going on
|
||
|
for (let i of Object.keys(paths)) delete paths[i];
|
||
|
|
||
|
// Paths
|
||
|
paths.seam = new Path()
|
||
|
.move(points.ventFoldRight)
|
||
|
.line(points.ventSlopeEnd)
|
||
|
.line(points.ventSlopeStart)
|
||
|
.line(points.elbowRight)
|
||
|
.curve(points.elbowRightCpTop, points.usRightEdgeCpBottom, points.usRightEdge)
|
||
|
.curve_(points.usRightEdgeCpTop, points.usTip)
|
||
|
.curve(points.usTipCpBottom, points.usLeftEdgeCpRight, points.usLeftEdgeRight)
|
||
|
._curve(points.usElbowLeftCpTop, points.usElbowLeft)
|
||
|
.line(points.usWristLeft)
|
||
|
.line(points.ventFoldRight)
|
||
|
.close()
|
||
|
.attr("class", "fabric");
|
||
|
|
||
|
paths.ventHint = new Path()
|
||
|
.move(points.ventSlopeStart)
|
||
|
.line(points.usWristRight)
|
||
|
.attr("class", "stroke-sm help");
|
||
|
|
||
|
paths.hem = new Path()
|
||
|
.move(points.usWristLeft)
|
||
|
.line(points.hemLeft)
|
||
|
.line(points.ventRight)
|
||
|
.line(points.ventFoldRight)
|
||
|
.attr("class", "fabric lashed");
|
||
|
|
||
|
return part;
|
||
|
}
|