2019-01-27 12:54:18 +01:00
|
|
|
export default part => {
|
2019-01-28 15:39:33 +01:00
|
|
|
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand();
|
2019-01-27 12:54:18 +01:00
|
|
|
|
|
|
|
points.A = new Point(45, 60);
|
|
|
|
points.B = new Point(10, 30);
|
|
|
|
points.BCp2 = new Point(40, 20);
|
|
|
|
points.C = new Point(90, 30);
|
|
|
|
points.CCp1 = new Point(50, -30);
|
|
|
|
points.D = new Point(50, 130);
|
|
|
|
points.DCp1 = new Point(150, 30);
|
|
|
|
|
2019-01-28 15:39:33 +01:00
|
|
|
paths.demo = new Path()
|
2019-01-27 12:54:18 +01:00
|
|
|
.move(points.D)
|
|
|
|
.curve(points.DCp1, points.DCp1, points.C)
|
|
|
|
.curve(points.CCp1, points.BCp2, points.B)
|
|
|
|
.line(points.A);
|
|
|
|
|
2019-01-28 15:39:33 +01:00
|
|
|
points.split = paths.demo.shiftFractionAlong(0.75);
|
2019-01-27 12:54:18 +01:00
|
|
|
snippets.x = new Snippet("x", points.split);
|
|
|
|
|
2019-01-28 15:39:33 +01:00
|
|
|
let style = "stroke-width: 3; stroke-opacity: 0.5;";
|
|
|
|
let halves = paths.demo.split(points.split);
|
2019-01-27 12:54:18 +01:00
|
|
|
for (let i in halves) {
|
2019-01-28 15:39:33 +01:00
|
|
|
paths[i] = halves[i]
|
|
|
|
.attr("style", style)
|
|
|
|
.attr("style", `stroke: hsl(${i * 70}, 100%, 50%)`);
|
2019-01-27 12:54:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return part;
|
|
|
|
};
|