sparkles: Added Path.edge() example
This commit is contained in:
parent
5850263ba2
commit
ebebbf368b
3 changed files with 41 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Examples</title>
|
||||
<script type="text/javascript" src="node_modules/freesewing/dist/browser.js"></script>
|
||||
<script type="text/javascript" src="freesewing.js"></script>
|
||||
<script type="text/javascript" src="node_modules/@freesewing/plugin-bundle/dist/browser.js"></script>
|
||||
<script type="text/javascript" src="dist/browser.js"></script>
|
||||
<script type="text/javascript" src="node_modules/@freesewing/plugin-theme/dist/browser.js"></script>
|
||||
|
@ -30,7 +30,7 @@
|
|||
// Some default settings
|
||||
pattern.settings.sa = 10;
|
||||
pattern.settings.units = 'metric';
|
||||
pattern.settings.only = 'utilsBeamCrossesY';
|
||||
pattern.settings.only = 'pathEdge';
|
||||
//pattern.on('preRender', function(next) {
|
||||
// this.style += 'g { border: 1px solid red; background: red;}';
|
||||
// next();
|
||||
|
|
|
@ -31,6 +31,7 @@ import pathJoin from "./path.join";
|
|||
import pathReverse from "./path.reverse";
|
||||
import pathShiftAlong from "./path.shiftalong";
|
||||
import pathShiftFractionAlong from "./path.shiftfractionalong";
|
||||
import pathEdge from "./path.edge";
|
||||
|
||||
import utilsLinesCross from "./utils.linescross";
|
||||
import utilsBeamsCross from "./utils.beamscross";
|
||||
|
@ -72,6 +73,7 @@ pattern.draft = function() {
|
|||
this.parts.pathReverse = this.draftPathReverse(new pattern.Part());
|
||||
this.parts.pathShiftAlong = this.draftPathShiftAlong(new pattern.Part());
|
||||
this.parts.pathShiftFractionAlong = this.draftPathShiftFractionAlong(new pattern.Part());
|
||||
this.parts.pathEdge = this.draftPathEdge(new pattern.Part());
|
||||
|
||||
this.parts.utilsLinesCross = this.draftUtilsLinesCross(new pattern.Part());
|
||||
this.parts.utilsBeamsCross = this.draftUtilsBeamsCross(new pattern.Part());
|
||||
|
@ -110,6 +112,7 @@ pattern.draftPathJoin = part => pathJoin.draft(part);
|
|||
pattern.draftPathReverse = part => pathReverse.draft(part);
|
||||
pattern.draftPathShiftAlong = part => pathShiftAlong.draft(part);
|
||||
pattern.draftPathShiftFractionAlong = part => pathShiftFractionAlong.draft(part);
|
||||
pattern.draftPathEdge = part => pathEdge.draft(part);
|
||||
|
||||
pattern.draftUtilsLinesCross = part => utilsLinesCross.draft(part);
|
||||
pattern.draftUtilsBeamsCross = part => utilsBeamsCross.draft(part);
|
||||
|
|
36
packages/examples/src/path.edge.js
Normal file
36
packages/examples/src/path.edge.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
import freesewing from "freesewing";
|
||||
|
||||
var pathEdge = {
|
||||
draft: function(part) {
|
||||
// prettier-ignore
|
||||
let {Point, points, Path, paths, Snippet, snippets, macro} = part.shorthand();
|
||||
|
||||
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(-60, 90);
|
||||
points.E = new Point(90, 190);
|
||||
|
||||
paths.example = new Path()
|
||||
.move(points.A)
|
||||
.line(points.B)
|
||||
.curve(points.BCp2, points.CCp1, points.C)
|
||||
.curve(points.E, points.D, points.A)
|
||||
.close();
|
||||
|
||||
snippets.a = new Snippet('x', paths.example.edge('topLeft'));
|
||||
snippets.b = new Snippet('x', paths.example.edge('topRight'));
|
||||
snippets.c = new Snippet('x', paths.example.edge('bottomLeft'));
|
||||
snippets.d = new Snippet('x', paths.example.edge('bottomRight'));
|
||||
snippets.e = new Snippet('x', paths.example.edge('top'));
|
||||
snippets.f = new Snippet('x', paths.example.edge('left'));
|
||||
snippets.g = new Snippet('x', paths.example.edge('bottom'));
|
||||
snippets.h = new Snippet('x', paths.example.edge('right'));
|
||||
|
||||
return part;
|
||||
}
|
||||
};
|
||||
|
||||
export default pathEdge;
|
Loading…
Add table
Add a link
Reference in a new issue